Jacinta Richardson wrote:
sed -e 's/\([^:]*\):\([^:]*\):\(.*\)/Question number \1\n\2\n\3\n/'
awk -F : '/^.+$/ {print "Question number "$1"\n"$2"\n"$3"\n"}'
Compared with the equivalent Perl one-liner:
perl -F: -anle 'print "Question number ",join "\n",@F,"";'
Apparently this is still too readable. It can also be written:
perl -F: -alpe '$"=$/;$_="Question number @F\n"';
Which shows all too clearly why some people think Perl is line noise. (Please
don't use golfed code in production).
All the best,
Jacinta
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html