Using csplit to divide a large file in smaller files with a determinated name

蓝咒 提交于 2019-12-11 16:46:19

问题


Having a very large plaint text file, with about 40 million lines, each line with the same length and format, we want to split it, line by line in N files using csplit. For example, if N is 80, the name of the generated files should be:

FILE00000001.txt
FILE00000002.txt
…
FILE00000080.txt

Note that FILE1.txt, FILE2.txt … FILE80.txt is not valid for us. Thanks!


回答1:


The parameter I was looking for is '-n 8'. Next example splits BIG_FILE.txt into 18 files of 5000 lines each of them:

csplit -f FILE -n 8 /a/b/c/BIG_FILE.txt 5000 {18}


来源:https://stackoverflow.com/questions/50566719/using-csplit-to-divide-a-large-file-in-smaller-files-with-a-determinated-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!