简体   繁体   中英

splitting large csv file with command line

I know OSX supports the linux-like split command.

I have a huge file file.csv

When I run

split -l 1000 file.csv new_

I get created one file new_aa but this file is the same as file.csv , it is not split.

EDIT : when I run file file.csv, I get ASCII text, with CR line terminators . Btw, running wc -l command shows that file.csv has 0 line

Your command is just fine:

split -l 1000 file.csv new_

However, it seems that you have some encoding problems. When you say file file.csv you get

ASCII text, with CR line terminators

So what you need is to port this file from MAC to UNIX. And this can be done with either of these:

mac2unix file.csv
dos2unix -c mac file.csv

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM