perl - Ignore lines in a file till match and process lines after that -


i looping on lines in file , when matched particular line, want process lines after current (matched) line. can :-

open $fh, '<', "abc" or die "cannot open!!";  while (my $line = <$fh>){    next if($line !~ m/important lines below line/);    last; } while (my $line = <$fh>){    print $line; } 

is there better way (code needs part of bigger perl script) ?

i'd use flip-flop operator:

while(<data>) {     next if 1 .. /important/;     print $_; } __data__ skip skip important lines below line keep keep 

output:

keep keep 

Comments

Popular posts from this blog

java - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -