I would like to split the following file based on the pattern ABC
:
ABC
4
5
6
ABC
1
2
3
ABC
1
2
3
4
ABC
8
2
3
to get file1:
ABC
4
5
6
file2:
ABC
1
2
3
etc.
Looking at the docs of man csplit
: csplit my_file /regex/ {num}
.
I can split this file using: csplit my_file '/^ABC$/' {2}
but this requires me to put in a number for {num}
. When I try to match with {*}
which suppose to repeat the pattern as much as possible, i get the error:
csplit: *}: bad repetition count
I am using a zshell.