And to understand Scott's easy to write, hard to understand approach: http://blog.geekuni.com/2016/03/perl-flip-flop.html
Andrew On Fri, Mar 18, 2016 at 3:50 PM, Scott Hall <banshee....@gmail.com> wrote: > > > On Fri, Mar 18, 2016 at 9:40 AM Prashant Thorat <thorat.prash...@gmail.com> > wrote: > >> Hi All, >> >> Can you please help me to grep below 'block of text' from my file ? this >> blocks occurs number of time & I want to grep all in between lines of this >> block - >> >> first line is having - retr_test asm1 >> & 4th line is having only - END >> >> so I want to grep all four lines with above match . >> >> > If you are looking for a command line that works like grep: > > perl -lne 'print if /retr_test asm1/ .. /END/;' input_file > > http://perldoc.perl.org/perlop.html#Range-Operators > > Best Regards, > > Scott > > >> Thanks in advance, >> Prashant >> >> >> -- Andrew Solomon Mentor@Geekuni http://geekuni.com/ http://www.linkedin.com/in/asolomon