Except you need the single quotes if the sep is some special shell char like '|'
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?


Ed

Robert Citek wrote:


On Thursday, Mar 31, 2005, at 16:13 US/Central, Ed Howland wrote:

$ echo -e 'a b\nc d\ne f\n' | xargs | tr ' ' ','
a,b,c,d,e,f


Cool. I didn't even realize xargs could be use without a command. So by default it echos/prints the arguments. BTW, we can shave off two more characters:

$ echo -e 'a b\nc d\ne f\n' | xargs | tr ' ' ,
a,b,c,d,e,f

What would be really nice is something like this:

$ echo -e 'a b\nc d\ne f\n' | xargs --ofs=,
a,b,c,d,e,f

but I don't see anything in the man page of xargs that enables that.

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


--
Ed Howland
WDT Solutions, LLC.
[EMAIL PROTECTED]
(314) 962-0766

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

Reply via email to