|
|
|
|
|
by __david__
4774 days ago
|
|
I think you want s///g on your second sed... Also that doesn't work in Mac OS X for some reason (their sed doesn't appear to interpret \n in the replacement text). I replaced it with perl to make that part work: perl -pe 's/ *\| */\n/g'
I still haven't gotten the whole thing to work yet because my history contains the above history pipeline and so it's splitting the "|" that inside the sed command onto multiple lines which is causing "xargs which" to balk because quotes are not matching or something: xargs: unterminated quote
Shells are amazing until spaces or quotes are involved! :-) |
|
Some systems seem to require \r instead of \n - I know vim's behavior differs from sed's in this, so that might be an issue.
With xargs balking, you can throw the error stream at that point, for convert it to a loop over the alleged commands:
Specifically: And yes spaces are a pig, and can lead to all sorts of ambiguities that don't have reasonable ways of resolving them, especially in filenames.