I'm tearing my hair out over this one. It used to be the case that in Unix one could split a line of text up into words - one per line - very easily - possibly in more than one way.
One way, which should work, is to use sed (the stream editor). It should be possible to issue a command (either verbatim, or similar to):
sed "s/ /\n/g" <inputfile
but this and many other similar commands steadfastly refuse to work in Mac OS 10.6.
It's possible to get the spaces substituted, but the line feed metacharacter \n refuses to work. I've tried putting various flags on, as recommended on different sites. Zilch!
I get the same result if I put the code into a shell script, or if I use source to run the script file. Changing the quotes doesn't do anything useful either - just in case any form of command substitution is taking place on the command line.
I've also tried changing the text file data in the file inputfile to use the line endings for different systems Unix, Windows, Mac - but to no avail.
Is this just Apple Mac OS being awkward? Is there a solution? What have Apple done to achieve this non-result?
One way, which should work, is to use sed (the stream editor). It should be possible to issue a command (either verbatim, or similar to):
sed "s/ /\n/g" <inputfile
but this and many other similar commands steadfastly refuse to work in Mac OS 10.6.
It's possible to get the spaces substituted, but the line feed metacharacter \n refuses to work. I've tried putting various flags on, as recommended on different sites. Zilch!
I get the same result if I put the code into a shell script, or if I use source to run the script file. Changing the quotes doesn't do anything useful either - just in case any form of command substitution is taking place on the command line.
I've also tried changing the text file data in the file inputfile to use the line endings for different systems Unix, Windows, Mac - but to no avail.
Is this just Apple Mac OS being awkward? Is there a solution? What have Apple done to achieve this non-result?
Comment