[Omaha.pm] "grep" huge files w/ no linefeeds

Andy Lester andy at petdance.com
Wed May 2 15:26:17 PDT 2007


On May 2, 2007, at 5:14 PM, Jay Hannah wrote:

> Tell Perl that your line delimiter is '|' and to print if a line
> contains 'MERGE-TO'.
>
> $ perl -nle 'BEGIN {$/="|"} print if (/MERGE-TO/)' myfile.txt

yay Perl!  You can also specify $/ on the command line with the -0  
(that's dash zero) flag.

perl -0x7C -nle'print if /MERGE-TO/' myfile.txt

See perldoc perlrun for more snazzy tricks.

xoxo,
Andy

--
Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance







More information about the Omaha-pm mailing list