Search code examples
mysqleol

merging type of EOL, (End of File)


I have some files, They're text files and I imported them via LOAD DATA mysql command into a database table. But I have problem with some of them.
All of them are 6236 lines:

$ wc -l  ber.mensur.txt 
6236 ber.mensur.txt

When I import ber.mensure.txt , only I have 1611 record in my table. But other files have 6236 row.

My LOAD DATA command is :

LOAD DATA INFILE '/home/mohsen/codes/haq/translation-tmp/ber.mensur.txt'
INTO TABLE tr_tmp  
FIELDS TERMINATED BY '' 
ENCLOSED BY '"'  
LINES TERMINATED BY '\n' (aya);

I use linux and I'm force to \n for end of line(EOL).

When I examine my databse, Some records contains more than one line. I think my end of lines has problem.

Do you have any solution to solve it?

UPDATE:

My file is here By the way, vim can know my txt file as 6236 lines.


Solution

  • You can do that via :

    fd = open(YOURFILE,'r')
    lines = readlines()
    

    It works good.