[英]splitting large csv file with command line
I know OSX
supports the linux-like split
command. 我知道
OSX
支持类似linux的split
命令。
I have a huge file file.csv
我有一个巨大的文件
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. 我创建了一个文件
new_aa
但是这个文件和file.csv
,它没有被拆分。
EDIT : when I run file file.csv, I get ASCII text, with CR line terminators
. 编辑:当我运行文件file.csv时,我得到
ASCII text, with CR line terminators
。 Btw, running wc -l
command shows that file.csv
has 0
line 顺便说一句,运行
wc -l
命令显示file.csv
有0
行
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 当你说
file file.csv
你得到
ASCII text, with CR line terminators
ASCII文本,带CR行终止符
So what you need is to port this file from MAC to UNIX. 所以你需要的是将这个文件从MAC移植到UNIX。 And this can be done with either of these:
这可以通过以下任何一种方式完成:
mac2unix file.csv
dos2unix -c mac file.csv
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.