John W. Krahn wrote:
John W. Krahn wrote:
Toby Stuart wrote:
Hello All
Hello,
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;
}
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
perl -F'\n' -0aple's/^##\s*//mg; s/\n/ && /g'
Oops, should be:
perl -F'\n' -lap0e's/^##\s*//mg; s/\s+\z//; s/\n/ && /g'
Correction:
perl -lp0e's/^##\s*//mg; s/\s+\z//; s/\n/ && /g'
John
--
Those people who think they know everything are a great
annoyance to those of us who do. -- Isaac Asimov
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/