Robert Citek wrote:
And if you want to be more obscure:
$ echo -e 'a b\nc d\ne f' | perl -le 'undef $/; $_=<>; print join(",", split)'
This one just seems more elegant than an xargs thing. There might be a maximum of 20k of input with xargs. So depending on your needs...
Maybe its just my preference for clean algorithms. Shell pipelines can get to seem unwieldy at times. String together small programs that do one thing and do that thing well is all fine and dandy until you can't find a certain 'one thing.' Then you often have to force fit it using more small programs to overcome the weakness. When that starts to happen, it is time to bring out the big guns!
Your need was to transform words seperated by whitespace or newlines into a comma seperated list. There is no single Unix commad for that. So you wrote one! And reading it left to right it clearly states the problem definition. (And nothing else but the problem definition, I might add.)
....
Treat newlines as whitespace
Read stdin
Save it
Split it on whitespace
output the result using a comma delimiter.
And now you are a famous hacker! Millions will benefit from what you have done!
Well I at least plan to add it to my toolbox.
Regards. Ed
-- 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
