Command of the day (24 Oct) - split

codlinuxsplit

split - Split file into pieces

    split -l 100 file : Put 100 lines/records per output file (useful with logs)

    split -b 1M file part_: Put 1Mb per output file

    split -b 200M file --filter'gzip > $FILE.gz':

    split -n l/4 data part_: Splits file in 4 parts with same number of lines

    split -n 5 file part_: Split in 5 files

    split -d -b 100 file part_: Produces part_00 part_01 part_02... (decimal numbering)

    split -x -b 100 file part_: Produces part_00 ... part_0A, part_0B... (hex numbering)

    split -f part_ -n3 file '/PATTERN/':

 

Get your free ebook

Learn GNU/Linux one command a day

Return to Home Page