February 6th, 2012, 01:57 PM
Moving text into a csv file
I did a CURL on a web page and stripped out the information I wanted and placed it inside a text file (data.txt).
Lets say it contains the following: (no comas)
John 15 65kb/sec
I am then wanting to pipe that into a master csv file.
How can I add john first, 15 second and so on.
The csv should look like this: John, 15, 65kb/sec,
is there a simple way to append and pipe it in the csv
adding the comas where the spaces are
data.txt >> masterlist.csv
Any help would be great,
Last edited by omgjtt; February 6th, 2012 at 02:09 PM.
February 6th, 2012, 02:26 PM
I found the answer. For those of you dealing with the same issue I would play around with the tr command. Here is a bit of code I hope helps
tr ' ' ',' <input >output
If you want to append the data please make sure to add two greater than signs
tr ' ' ',' <input.txt >> output.csv