Mar 8, 2012, 5:42 PM
Post #1 of 3
perl equivalent of sed to select a range in file.
I'm looking for an equivalent perl code to work like the following sed command.
sed -n '/begin_pattern/,/end_pattern/p' $myfile
What I currently do in perl is to read the whole file into an array and loop through till I get the range from starting and ending pattern. It works but is very inefficient.
Anyone can help with the equivalent command?