This is a simple and contrived example of a block replacement. Adapt it to your own application.
InFile1 ...
Code:
one
two
three
four
five
six
seven
eight
nine
ten
InFile2 ...
The first
sed makes a copy of lines 1-3 in a work file and the second
sed makes a copy of lines 7-EOF in another work file. The
cat combines those work files with a second input file making a conceptual "sandwich."
Code:
sed '3q' $InFile1 >$Work1
sed '1,6d' $InFile1 >$Work2
cat $Work1 $InFile2 $Work2 >$OutFile
Executing this code produced this OutFile ...
Code:
one
two
three
FOUR
FIVE
SIX
seven
eight
nine
ten
Daniel B. Martin