#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2010
    Posts
    35
    Rep Power
    15

    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,

    James
    Last edited by omgjtt; February 6th, 2012 at 02:09 PM.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2010
    Posts
    35
    Rep Power
    15
    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

    Thanks

IMN logo majestic logo threadwatch logo seochat tools logo