[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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




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@petdance.com => www.petdance.com => AIM:petdance