unpreprocess.pl 303 B

12345678910111213141516171819
  1. #!/usr/bin/perl
  2. use strict;
  3. my $file = "";
  4. my $first = 1;
  5. my $emit = 0;
  6. while(<>) {
  7. if ($first) {
  8. $_ =~ m/^#\s*\d+\s+"(.*)"/;
  9. $file = $1;
  10. $first = 0;
  11. } elsif ($_ =~ m/^#\s*\d+\s+"(.*)"/) {
  12. $emit = ($1 eq $file);
  13. } elsif ($emit) {
  14. print $_;
  15. }
  16. }