You are not logged in.
from a kernel PKGBUILD, I need to be able to cut the following line and all other lines below it so I can echo it into a file. :
cat ../config | sed "s|#CARCH#|$carch|g" >./.config
Offline
Not sure what the question is, nor what exactly you want to do, so I'll take a wild guess:
cat << END > somefile
cat ../config | sed "s|#CARCH#|$carch|g" >./.config
...
...
END
Offline
sorry
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.
Offline
Best to just make a diff and use patch to do it. There are other ways, but that's probably the cleanest solution. Though that line is strange as it is, why don't you do it yourself instead of letting .config do the cat/sed commands?
Offline
Its for a program I'm doing. It can use any of the kernel PKGBUILDS so, the only line that is common, and Im concerned with is "cat ../config sed | bla blawant" I just want to be able to insert my command before it. If each of these PKGBUILDs are different. Will I still be able to patch as you suggested. If so could you give me an example of how to do it?
Offline
You could do something like the following, though there must be a better way:
sed 'sXcat ../config | sedXblablancat ../config | sedX'
Offline
What I understand, the idea is to goto a particular line in PKGBUILD and insert new lines with stuff.
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
Markku
Offline
that works good for build() but it doesn't like the line I need. Seems like the forward slash in it ends it prematurely. I guess I'll have to read up on sed more later...damn tricky a$$ sed. :x
Offline
you dont have to use / for sed you know, you can use other characters like @ too. take a look in the manual, there should be some listed.
Offline
I got it working by using:
sed '/cat ../config | sed "s|#CARCH#|$carch|g" >./.config/i
bla
bla' sourcefile > tempfile
thanks for everyone's help
Offline