23 Jan
2008
23 Jan
'08
02:40
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. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org