split/csplit Examples

split/csplit Examples

split - split a file into pieces 

split [OPTION]... [INPUT [PREFIX]] 

-b <size>: put <size> bytes per output file (K, KB, MB, GB, TB)
-l <number>: put  <number> lines per output file
-d: use numeric suffixes for filenames
-a <n>: use suffixes of length <n>


csplit - split a file into sections by context lines


-b <FORMAT>: use sprintf <FORMAT> instead of %02d
-f <PREFIX>: use <PREFIX> instead of 'xx'
-n <DIGITS>: use specified number of digits instead of 2
-s: do not print counts of output file sizes
-k: do not remove files on error (an error already exists if the last file has not the desired size)

Read standard input if FILE is -. Each PATTERN may be:

    copy up to but not including specified line number 
    copy up to but not including a matching line 
    skip to, but not including a matching line 
    repeat the previous pattern specified number of times 
    repeat the previous pattern as many times as possible
for further information see the manual pages split(1), csplit(1)

all examples assembled by andreas schmidt for the IC3K 2022 conference