Linux 如何分割大文件?
我有一个很大的CSV文件(7.3GB;16300000行),如何将此文件拆分为两个文件?您是否查看了Linux 如何分割大文件?,linux,Linux,我有一个很大的CSV文件(7.3GB;16300000行),如何将此文件拆分为两个文件?您是否查看了拆分命令?有关更多信息,请参见手册页 这包含此命令的示例使用 旁白: 如果您不确定特定命令是什么,那么man-k命令对于查找unix/linux命令非常有用。使用man-k命令指定一个关键字,系统将拉出相关命令。例如: % man -k split 将产生: csplit (1) - split a file into sections determined by conte
拆分命令?有关更多信息,请参见手册页
这包含此命令的示例使用
旁白:
如果您不确定特定命令是什么,那么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
split-d-n l/n filename.csv tempfile.part
将文件拆分为N个文件而不拆分行。如上所述,每个文件中都没有重复标题 @spk:语法正确,但这会将您的文件拆分为326000个文件。您应该选择一个更高的值,任何大于8150000小于16300000的值都将创建两个文件。如@spk所述,选择正确的值将满足您的需要。如果您提出的任何问题都能为您的问题提供正确的答案,请随意接受它们-当使用split
分割CSV文件时,请注意CSV标题不会对每个文件重复。