dee00zee has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I want to print only the lines other than FIELD
and ); following it on the next line, but my code didn't work.
CODE
and ); following it on the next line, but my code didn't work.
CODE
HERE IS THE DATA$ver="abc.txt"; open (IN,$ver); $new="new.txt"; open(OUT,"> $new"); while ($string=<IN>) { if ($string=~ /^FIELD/) { next; $line=<IN>; next if $line=<IN>; } else { @lines=split(/\s+/,$string); print OUT "@lines\n"; } }
These are all wanted data ); Please insert your marks ); FIELD 10 ); FIELD 11 ); FIELD 12 ); FIELD 13 ); FIELD 14 );
Janitored by Arunbear - added code tags, as per Monastery guidelines
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: don't want to print certain lines
by bart (Canon) on Oct 27, 2004 at 01:56 UTC | |
Re: don't want to print certain lines
by krusty (Hermit) on Oct 27, 2004 at 01:37 UTC | |
by dee00zee (Novice) on Oct 27, 2004 at 01:56 UTC | |
by pg (Canon) on Oct 27, 2004 at 02:05 UTC |
Back to
Seekers of Perl Wisdom