From BStegmaier

Jump to: navigation, search
csplit [options] file pattern
  • Pattern
    • Copy up to but not including LINENUMBER
    • Copy up to but not including matching /REGEXP/[OFFSET]
    • Skip to but not including matching %REGEXP%[OFFSET]
    • Repeat Pattern {n} times, where n can be infty *
    • OFFSET shifts the offset of cutting by any +-integer


  • Suffix in sprintf format
-b %02d


  • Prefix
-f xx


  • Silent
-s


Example

Silently split stdin 5 lines before occurance of pattern 'blub'. repeat this 4 times files are named blub + 3digit number

csplit -s -f blub -b %03d - '/blub/-5' '{4}'