Hi,
This could help (awk based):
Code:
#!/bin/bash
awk '
# only match lines between FrameBegin and FrameEnd (included)
/^FrameBegin/,/^FrameEnd/ {
# If first field equals FrameBegin, create outputfile ($1 + $2)
if ( $1 ~ /^FrameBegin/ ) {
outputfile = $1 $2
}
# if line does not start with Frame, put it in appropriate outputfile
if ( $1 !~ /^Frame/ ) {
print $0 >> outputfile
}
}
' $1
Save and execute as: progname infile
I took the liberty to create outputfilenames based on FrameBegin 1, FrameBegin 2 etc. (the number being the unsure thing....). It's there to give you an idea and can be changed to your liking.
The importent part is the
/^FrameBegin/,/^FrameEnd/ part. This makes sure that only the Frames and wat is inside are targeted.
You can do something simular with sed:
sed -n '/^FrameBegin/,/^FrameEnd/p' infile.
Hope this clears things up a bit.