Great. Thankyou chenxy. -----Original Message----- From: chenxy [mailto:tin...@gmail.com] Sent: Friday, 13 March 2009 2:01 PM To: Toby Stuart Cc: beginners@perl.org Subject: Re: one liner need help
2009/3/13 Toby Stuart < toby.stu...@figtreesys.com.au> Hello All It's been almost 13 years since I last posted on this board and my Perl skills are extremely rusty. Could someone help me to convert this to a one liner:- use strict; use warnings; while (<>) { /^##\s*(.*)$/ && print $1; print " && " unless eof; } try this: perl -n -w -e'/^##\s*(.*)$/ && print $1.((eof)?"":" && ")' tmp.txt Input file looks like this:- ## sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com ABF3B2646E619416 ## sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 1024R/43CBFCC0 PS. Where is $Bill? Is he still around? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/