On Tue, Dec 19, 2006 at 01:10:44AM +1100, Jacinta Richardson wrote:
> Alexander Samad wrote:
> 
> >Haven't seen the previous emails but what about
> >
> >sed -e 's/\([^:]*\):\([^:]*\):\(.*\)/Question number \1\n\2\n\3'
> >
> >or even
> >
> >awk -F : '/^.+$/ {print "Question number "$1"\n"$2"\n"$3}'
> 
> Very cool.  Although probably not going to help the OP learn how to 
> program. Your sed program is missing it's final /.  Also you're missing the 
> double newline between Questions.  Adding this gives:

true bad cut and paste! but you don;t need the last \n as it is part of the
input line any way
> 
> 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,"";'
> 
> I think the Perl golf wins.  ;)  Which is cute, because I honestly thought 
> awk would.
> 
> All the best,
> 
>       J
> -- 
> SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
> Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
> 

Attachment: signature.asc
Description: Digital signature

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to