On Friday, Apr 1, 2005, at 09:20 US/Central, Robert Citek wrote:
On Thursday, Mar 31, 2005, at 16:54 US/Central, Ed Howland wrote:
Perl seems more versatile here. Isn't the way: chomp the input, slurp entire <> into a string, split the string on any whitespace, then join with the desired sep?

Perl could do it, but it seems less elegant:

$ echo -e 'a b\nc d\ne f' |
perl -le 'while(<>) {$foo.=$_ } ; print join(",", split(/\s+/, $foo)) '

And if you want to be more obscure:

$ echo -e 'a b\nc d\ne f' |
  perl -le 'undef $/; $_=<>; print join(",", split)'

Regards,
- Robert
http://www.cwelug.org/downloads
Help others get OpenSource software.  Distribute FLOSS
for Windows, Linux, *BSD, and MacOS X with BitTorrent

_______________________________________________
CWE-LUG mailing list
http://www.cwelug.org/ [email protected]
http://lists.firepipe.net/listinfo/cwe-lug

Reply via email to