skyler has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; my $infile = 'c:\\hl7file2.txt'; my ( $yr, $mo, $dy ) = (localtime)[5,4,3]; my $outfile = sprintf( "%04d%02d%02d.txt",$yr+1900,$mo+1,$dy ); my $counter; open IN, "<$infile" or die "Couldn't open $infile, $!"; open OUT,">$outfile" or die "Couldn't open $outfile, $!"; $counter++; print $counter; my @finds = qw( 00000 00001 00002 00003 00004 76370 76375 76950 77403 +77404 77406 77407 77408 77409 77411 77412 77413 77414 77416 77418 + 77370 77336 77417 ); my $finds_re = join '|', map { quotemeta }@finds; $finds_re = qr/$finds_re/; print $finds_re; while(<IN>) { next if m/$finds_re/; print OUT; } close IN;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to move unwanted lines out of a file
by graff (Chancellor) on Mar 19, 2004 at 01:16 UTC | |
by skyler (Beadle) on Mar 23, 2004 at 20:06 UTC | |
|
Re: How to move unwanted lines out of a file
by cormac (Acolyte) on Mar 18, 2004 at 20:45 UTC | |
|
Re: How to move unwanted lines out of a file
by Fletch (Bishop) on Mar 18, 2004 at 20:32 UTC | |
|
Re: How to move unwanted lines out of a file
by TomDLux (Vicar) on Mar 19, 2004 at 02:31 UTC |