I have a large text file that has a repeating set of data with the header -XXXX-
and the footer $$$$
for each entry. There are around 20k entries and I would like to separate it out into files of 500 entries each.
I've been toying around with awk
and am using the command below which it close. Each file starts with -XXXX-
but every file after the first has a partial entry at the end.
awk "/-XXXX-/ { delim++ } { file = sprintf(\"file%s.sdf\", int(delim / 500)); print > file; }" < big.sdf
For example:
-XXXX-
Beginning
Middle
End
$$$$
-XXXX-
Beginning
I instead want each file to end right after the $$$$
.
I am using awk
on Windows.