mysql - Import CSV Line Break Woes -
I am using BASH script to run data loaded INSILE to MySQL. I have a problem correctly Trying to finish After running my script I find out that every other line has left. Here are some example data:
CSV file read:
"POL", "condition", "type", "code", "MODE", "number" "220", "TGS", "NA", "N", "N", "N", "AS", "M6", "793930" "220", "1653912," "TGS" M6 "," 793975 "" 220 "," 1471618, "TGS", "NA", "AS-T6", "M6", "793915" "
CSV file to import bash script:
pass mysql -u $ -p $ D $ Db
But here my rows appear in my database: 220 1243918 TGI NA-T5 M6 793,930 " "220 220 1,471,618 as TGS NA - T6 M6 793,915" "220
Documents in the previous field NUMBER notes two quotation marks and CA Notice the first field in the next file in the V file, the second row has been omitted.
I have tried many different lines of options, but it just did not know how the line break
= "Text">
You can see if your file is running in a strange Windowsy carriage return:
cat -vet yourfile
< P> and searching for "^ m" Switch to You
tr -d '\ r' & lt; Windows File & gt; Edit
By using your comments, you can finally see two sets of two adjacent double quotes by using
or "dos2unix" Of lines - is this right? If so, then you can use it to change two lots of quotes at the end of the line with a set:
sed 's / "$ /" /' yourfile & gt; Newfile
Comments
Post a Comment