I use csplit to write separate smaller files from a single larger file
#!/bin/bash
OBJECT=$1; $TARGET="bigfile.pgn";
FIRST_NEW_GAME=$2;
csplit $TARGET /Event/ {*};
ls xx*
echo 'How many games do we have?'; read NUMGAMES
#xx00 xx01 xx02 xx03 xx04 xx05
# I just grab "5" for $NUMGAMES
I now have the 5 files and am ready to rename them to $FIRST_NEW_GAME+1
while [ $X -le $NUMGAMES ]; do
let X=X+1
pseudo code: mv xx[01-05] 5337+[$X].pgn
done;
I have xx[01-01] and want to create FIRST_NEW_GAME ("5436") + $X For example: xx01 becomes 5336.pgn, xx02 becomes 5337.pgn, etc.
But that last while loop is beyond my scope. Any ideas?
--suffix-format&--prefix. See if those will help you. You might not need any additional bash code at all...