Hi.
Command
csplit was designed for this:
Code:
#!/usr/bin/env sh
# @(#) s1 Demonstrate context split, csplit.
set -o nounset
echo
debug=":"
debug="echo"
## Use local command version for the commands in this demonstration.
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version bash csplit
echo
# Remove debris files.
rm -f xx*
FILE=${1-data1}
csplit --keep-files -z $FILE "/Company Code/-1" {*}
echo
echo " Files created:"
ls xx*
SAMPLE=xx01
echo
echo " Sample $SAMPLE:"
cat -n $SAMPLE
exit 0