in reply to Re^2: Get file part from the section where the matched pattern is found.
in thread Get file part from the section where the matched pattern is found.

if you meant that you want to print the line with the regex and the next line to it
then simply add last; in the first if section

if($found) { print "$line"; last; }
this will get you the output
startdexdbnjcrk this when be shown

UPDATE:and if you want to print more lines then youll be needing a counter and check each time with "if" weather the desired number of lines have been printed or not. if yes then exit.


there be many shortcuts but i guess this one is the simplest for a newbie like me to understand