sed '/cat ../config | sed "s|#CARCH#|$carch|g" >./.config/i
bla
bla' sourcefile > tempfile
thanks for everyone's help
]]>I did a search (sed find and insert) and found this link:
http://www.unix.com/archive/index.php/t-9831.html
EDIT
Here is a sample to insert text under the "build() {" line with append "a" (to insert above the line use "i")
sed '/^build() /a
your text goes here' /test/PKGBUILD > /test/PKGBUILD.test
sed 'sXcat ../config | sedXblablancat ../config | sedX'
cat ../config | sed "s|#CARCH#|$carch|g" >./.config
is the complete line off the file. I needed that line and all lines below it echoed into another file such as temp.bottom and if possible, remove the bottom half of the original file in which it came. Basically like a "cut and paste" if you were using a gui. Essentially, I want to insert my own lines after that given line and put the rest back in place.
]]>cat << END > somefile
cat ../config | sed "s|#CARCH#|$carch|g" >./.config
...
...
END