Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, I am trying to use mysqlslurp. It takes a csv and pipes it to mysql i have a delimited text file i am trying to upload, however each field ...
  1. #1
    Just Joined!
    Join Date
    May 2009
    Posts
    1

    Smile how to use cut or cat to prepare delimited csv file for mysql upload?

    Hi,

    I am trying to use mysqlslurp. It takes a csv and pipes it to mysql
    i have a delimited text file i am trying to upload, however each field is separated by "|"
    1) is it possible to delimit with anything other than TAB when using cat?
    2) if cat cant do this, is it possible to do with cut - just not sure how to work around the "|"
    3) or can i use some mysqlimport options in mysqlslurp? here it says something about it but its not v clear - from the mysqlslurp site: (cant post link)
    [options passed to mysqlimport]
    ( see mysqlimport --help for a list of options )

    PS: the reason for using mysqlslurp is to keep things fast because i have huge amounts of data, i am guessing that creating another process before mysqlslurp, such as sed or awk will slow things down even further?
    Cheers in advance for any help

  2. #2
    Linux Guru
    Join Date
    Nov 2004
    Posts
    6,110
    You can use tr to change that one character to a comma or tab but I'd say your best bet would be sed or awk. The cat command will simply dump information out as it is unless you use the a switch such as -T to change how it treats tabs.

    You could use awk/sed either to prepare the files beforehand or just to translate inline through a pipe.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...