Spliiting a Huge text or CSV file into smaller chunks

I got into a situation where i had to import a 10GB CSV file into mysql. I tried to open the file using excel, but it hanged and gave errors of Lesser Resources (RAM). 

Then I came to know about one less know tools of Linux shell called ‘csplit’.

I ran the command:

# csplit -k tenGB.csv +50000 {*}

-k = do not delete  the files on error encounter

+50000 = split to a new file after 49999 lines

{*} = repeat the same pattern on next files.

 

 

it created almost 43 files. with pattern xx00, xx01 and so on…

then i renamed all these files using the command:

#for f in *; do mv "$f" "${f%}.csv"; done

and thats it!!