You are not logged in.
Pages: 1
I would like to replace a line in a file using sed when a program makepkg -c is run
Here's the line I have now:
sed -i "s//usr/local/$startdir/pkg/usr/" $startdir/file
The idea is to replace /usr/local in the file with $startdir/pkg/usr, but with $startdir expanded. I initially thought the double quotes around the sed command would work, but apparently not. The file ends up having "$startdir" actually in the line rather than what the script thinks it expands to. It is very annoying.
Does anybody know how to make this work?
Offline
why not take a look at the several PKGBUILDs that use sed commands to see if you can figure it out? sorry it has been a LONG time since i worked on packages so I cannot point you directly to one.
AKA uknowme
I am not your friend
Offline
I have no idea which packages use sed, though I'm sure they're there.
http://arch.subpop.net/sources/cedega/PKGBUILD
I found that one!
Offline
aha! I refined my google search and came up with something useful.
sed -i "s%/usr/local%$startdir/pkg/usr%g" $startdir/file
IT WORKED!!
w00t
Offline
you could have grepped the abs directory for PKGBUILDs that used sed btw.
glad you found your answer though
AKA uknowme
I am not your friend
Offline
you could have grepped the abs directory for PKGBUILDs that used sed btw.
glad you found your answer though
But I so rarely ever use grep or cat that I'm completely useless with them.
Offline
grep -R "sed" /var/abs
Sit back and watch the scrolling joy!
In fact, you might want to redirect output to a file, or pipe it to less...
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
Pages: 1