Split a file at a line matching a regular expression

csplit

  • Split a file into pieces.
    This generates files named "xx00", "xx01", and so on.
    More information: <https://www.gnu.org/software/coreutils/csplit>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

csplit {{file}} /{{regular_expression}}/

click the source code to copy install csplit on any operating system with command-not-found.com