How to split one text file into multiple *.txt files?

前端 未结 9 631
[愿得一人]
[愿得一人] 2020-12-07 17:39

I got a text file file.txt(12 MBs) containing:

something1
something2
something3
something4
(...)

Is there any way to split

9条回答
  •  北海茫月
    2020-12-07 18:21

    If each part have the same lines number, for example 22, here my solution:
    split --numeric-suffixes=2 --additional-suffix=.txt -l 22 file.txt file
    and you obtain file2.txt with the first 22 lines, file3.txt the 22 next line…

    Thank @hamruta-takawale, @dror-s and @stackoverflowuser2010

提交回复
热议问题