开发者

how to import table in txt to mysql, with garbage on top and bottom of the file?

开发者 https://www.devze.com 2023-01-20 06:02 出处:网络
Let say I have a file with 20 lines, the first 3 lines are useless instruction for using the table, the 4th line is the header, the 5th to 17th lines are tab-delimited data, and the 18th to 20th lines

Let say I have a file with 20 lines, the first 3 lines are useless instruction for using the table, the 4th line is the header, the 5th to 17th lines are tab-delimited data, and the 18th to 20th lines are some useless remarks. And I want to import the table from the 4th line to the 17th 开发者_StackOverflowline. How can I do it in MySQL? Something to work with "SKIP"?

Thanks!


You have the option to ignore the first x lines. The rest you have to parse and remove by other logic, maybe a store procedure.


To ignore the lines at the top of the file you can use the --ignore-lines option.

 --ignore-lines=N
           Ignore the first N lines of the data file.
0

精彩评论

暂无评论...
验证码 换一张
取 消