I have this file 1.txt
:
-e a
b
-e c
d
-e e
f
I want to split it into the following two files.
2.txt
-e a
-e c
-e e
3.txt
b
d
f
where 2.txt
contains all the lines starting with -e
, and 3.txt
contains all the other lines. Extra newlines (such as the extra newline in the middle of the original) can be ignored or kept, and order doesn't matter.
I've tried using split
, but it doesn't look like that allows me to use a pattern for splitting (instead a fixed number of lines per split file).