Reading comma(,) separated value in Shell script from CSV file
hi team,
From shell script i want to insert column value which is having comma (,) separated in to Mysql table from CSV file. like Test1 ----- Test,Test1,Test2 |
Welcome. There are quite a few ways to insert a field, some of them use "awk". What have you tried? We can provide feedback or help where you are getting stuck.
|
Actually reading the MySQL manual would answer the question.
http://dev.mysql.com/doc/refman/5.7/en/load-data.html Google can really help you. |
Here is the format.
`$mysql -uuser -ppassword schema -e 'Load data infile "'$File_Path'" into table table_name CHARACTER SET LATIN1 FIELDS TERMINATED BY "|" OPTIONALLY ENCLOSED BY """" LINES TERMINATED BY "\r\n" IGNORE 1 LINES (column1,column2,column3);'` Column 2 will be having data like "x,y,z" and it should be inserted as same i.e, x,y,z |
Quote:
Otherwise, check out any of the many, MANY thousands of easily-found bash scripting tutorials you can find with a Google search. |
Quote:
|
Why FIELDS TERMINATED BY "|" if input file is csv
|
All times are GMT -5. The time now is 11:17 PM. |