如何拆分大文件?

spr*_*ran 6 linux

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

Lev*_*von 16

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

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

在旁边:

man -k命令是找到的Unix/Linux命令,如果你不太清楚具体的命令就是相当有用.使用man -k命令指定关键字,系统将提取相关命令.例如,

% man -k split
Run Code Online (Sandbox Code Playgroud)

会产生:

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
Run Code Online (Sandbox Code Playgroud)

  • @spk:语法正确,但这会将您的文件拆分为3,260,000个文件.您应该选择更高的值,任何高于8,150,000且低于16,300,000的数量都将创建两个文件. (4认同)