I have a print output file (uncomp.txt) that has form feeds in it. I'm trying to split the single document into multiple documents based on the \f regex match, and outputting files with the epoch time.
I've tried this:
$ csplit --prefix=$(date +%s) -s /tmp/uncomp.txt "/%\f%/+1" "{*}"
as well as this:
$ csplit --prefix=$(date +%s) -s /tmp/uncomp.txt "/\f/+1" "{*}"
and even this:
$ csplit -s --prefix=$(date +%s) /tmp/uncomp.txt /\f/ {*}
But each time I end up with a single file. It's apparently not picking up the \f regex... What am I doing wrong?
bash solution
It appears that
csplitrequires a literal formfeed in its regex. One way to achieve that is to use bash's$'...'construct:POSIX solution
If you don't have bash, you can use
printf:Or, equivalently: