I have a file that looks something like this:
CBA ABC
line 1
line 2
DFCF ABC
line 1
line 2
I want to split the file into two separate files that look like this:
File 1
CBA ABC
line 1
line 2
File 2
DFCF ABC
line 1
line 2
I'm using the following code:
But since ABC does not come first in any of the lines, the code is unable to detect it.
How do I get the files to split whenever "ABC" appears in a line?
CBA ABC
line 1
line 2
DFCF ABC
line 1
line 2
I want to split the file into two separate files that look like this:
File 1
CBA ABC
line 1
line 2
File 2
DFCF ABC
line 1
line 2
I'm using the following code:
Code:
for filename in *.txt; gcsplit -z -f "${filename%.*}_" --suffix-format="%d.txt" $filename '/ABC/ ' '{*}'
But since ABC does not come first in any of the lines, the code is unable to detect it.
How do I get the files to split whenever "ABC" appears in a line?