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

前端 未结 9 634
[愿得一人]
[愿得一人] 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:07

    Try something like this:

    awk -vc=1 'NR%1000000==0{++c}{print $0 > c".txt"}' Datafile.txt
    
    for filename in *.txt; do mv "$filename" "Prefix_$filename"; done;
    

提交回复
热议问题