in reply to upto match please, my one-lina!!


Here is a one-liner that emulates grep -B (although not as elegantly for adjacent matches):
perl -ne '$a[$i=$.%4]=$_; print @a[$i+1..$#a,0..$i], "--\n" if /re +gex/' file

--
John.

Replies are listed 'Best First'.
Re^2: upto match please, my one-lina!!
by Firefly258 (Beadle) on Jun 09, 2006 at 00:54 UTC
    Thanks guys .. looks like it's a ubiquitous solution although approached via TMTOWTDI. Sure beats my long ineffeciency. :)