tags:

views:

21

answers:

2

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 line. How can I do it in MySQL? Something to work with "SKIP"?

Thanks!

A: 

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.
codaddict
A: 

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.

Elzo Valugi
then what about the last N lines?
lokheart
I would suggest to move the parsing logic from the db layer to application layer, like PHP or Java. Filter there the text and only insert relevant rows. Mysql is not the best choice for this, but you could do it probably in a stored procedure.
Elzo Valugi