6

我有一个大的 CSV 文件(7.3GB;16,300,000 行),如何将此文件拆分为两个文件?

4

2 回答 2

16

你看过split命令吗?有关更多信息,请参见此 手册页。

页面包含此命令的示例用法。

在旁边:

man -k如果您不太确定特定命令是什么,该命令对于查找 unix/linux 命令非常有用。使用 man -k 命令指定关键字,系统会拉出相关命令。例如,

% man -k split

将产生:

csplit (1)           - split a file into sections determined by context lines
dirsplit (1)         - splits directory into multiple with equal size
dpkg-split (1)       - Debian package archive split/join tool
gpgsplit (1)         - Split an OpenPGP message into packets
pnmsplit (1)         - split a multi-image portable anymap into multiple single-image files
ppmtoyuvsplit (1)    - convert a portable pixmap into 3 subsampled raw YUV files
split (1)            - split a file into pieces
splitdiff (1)        - separate out incremental patches
splitfont (1)        - extract characters from an ISO-type font.
URI::Split (3pm)     - Parse and compose URI strings
wcstok (3)           - split wide-character string into tokens
yuvsplittoppm (1)    - convert a Y- and a U- and a V-file into a portable pixmap
zipsplit (1)         - split a zipfile into smaller zipfiles
于 2012-05-13T11:35:42.947 回答
1

拆分 -d -nl/N 文件名.csv tempfile.part。

将文件拆分为 N 个文件而不拆分行。正如上面评论中提到的,每个文件中的标题都不会重复。

于 2015-12-05T08:47:43.050 回答