On January 22, 2008 09:40:32 pm Scott Simpson wrote: > Shell version: > fgrep 'blah blah blah' file | head -1 | sed 's/^.*: > \([0-9][0-9]*\).*$/\1/' > numberfile > > Perl version: > perl -n -e 'if (/blah blah blah/) { s/^.*: ([0-9]+).*$/$1/; print $_; > exit(0); }' < file_with_blah > numberfile > > Shell version will fork three processes; the Perl version will fork > one and the Perl version will quit right after it finds the matching > line.
Thanks a lot Scott, Recently I gotta play around with text files too much, hopefully that will make me to start reading some shell scripting soon! Cheers, -- Sergey Mkrtchyan, PhD Student @ Department of Physics & Astronomy, Faculty of Science, University of Waterloo -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]