On Friday 20 February 2004, john.allen at dublinux.net (John Allen) wrote:
>> Two characters less to type, and just a tiny bit less satisfying is:
>>>>>> perl -ne 'if (/1^(2)/) {print} else { exit if $1}' humungous_file
>>>>>>This one does not work though.
That's right - I've no idea where the 1 after the / came from :-)
However, the whole thing is moot as Padraig is in a quest for speed, so
the capture here is a bad idea (because it's relatively slow). Anyway, C
and readline is probably the way he'll go. My Perl solution was written
for conciseness and cuteness, not speed. And unlike a lot of Perl
one-liners, it was understandable by mortals.
Niall
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!