Split file by vector of line numbers

前端 未结 5 1664
礼貌的吻别
礼貌的吻别 2021-01-27 03:41

I have a large file, about 10GB. I have a vector of line numbers which I would like to use to split the file. Ideally I would like to accomplish this using command-line utilitie

5条回答
  •  爱一瞬间的悲伤
    2021-01-27 04:01

    This might work for you:

    csplit -z file 2 5
    

    or if you want regexp:

    csplit -z file /2/ /5/
    

    With the default values, the output files will be named xxnn where nn starts at 00 and is incremented by 1.

    N.B. The -z option prevents empty elided files.

提交回复
热议问题