perl -nle 'BEGIN {$pat = shift @ARGV} push @c, $_; shift @c if @c > 3; $c =
join "\n", @c; print "$c\n----\n" if $c =~ /$pat/o'Usage: <one-liner> REGEXP FILE ... This hardcodes 3 as the context value, if you want better options (for example, if you want to use substrings intsead of regexps for matching, -v, etc.) you probably need more than a single line. On Mon, Nov 28, 2011 at 2:28 PM, Yossi Itzkovich < [email protected]> wrote: > Hi,**** > > ** ** > > In this link : http://docstore.mik.ua/orelly/unix/upt/ch27_13.htm**** > > They mention cgrep that is implemented in Perl.**** > > ** ** > > Does someone have such implementation ?**** > > Is there a one-liner ("real" one liner) solution ?**** > > ** ** > > Regards**** > > ** ** > > Yossi**** > > This e-mail message is intended for the recipient only and contains > information which is CONFIDENTIAL and which may be proprietary to ECI > Telecom. If you have received this transmission in error, please inform us > by e-mail, phone or fax, and then delete the original and all copies > thereof. > > ______________________________________________________________________ > This email has been scanned by the Symantec Email Security.cloud service. > For more information please visit http://www.symanteccloud.com > ______________________________________________________________________ > > _______________________________________________ > Perl mailing list > [email protected] > http://mail.perl.org.il/mailman/listinfo/perl > -- Gaal Yahas <[email protected]> http://gaal.livejournal.com/
_______________________________________________ Perl mailing list [email protected] http://mail.perl.org.il/mailman/listinfo/perl
