splitting of comma separated values file (horizontal) into a list (vertical ) list
I am a real newbie at all of this; both *nix and forums so please forgive me if I make any "faux pax's".
Just so you know, this is not some homework, I am way too old I promise! I am starting out in *nix scripting and wanted to know the best was to make a list of values out of a comma separated file, and place the list of values into a new file. So for example:
dog, cat, mouse, horse, etc
and I would like the following.
file2 will contain:
any hints, tips greatly appreciated. Thank You!
(btw I checked previous posts but did not find anything relevant.)
Without just giving you the answer:
"tr" can do this. Replace commas with newlines, and optionally remove spaces.
Agreed, tr is probably the simplest but tools like sed and awk are also available. Have a look at the man page for each and you should make short work of your problem :)
Thanks Guys! I just needed a nudge in the general direction - hope to meet again in the ether sometime :)
|All times are GMT -5. The time now is 02:21 PM.|