I am requiring a little help with sed.
If have this file which i wish to run sed on:
Code: Select all
/usr
/usr/bin
yad
/usr/share
/usr/share/pixmaps
yad.png
This sed code seems to do what i require - which is to add /root only to the start of the lines that begin with a forward slash /
sed result:
Code: Select all
/root/usr
/root/usr/bin
yad
/root/usr/share
/root/usr/share/pixmaps
yad.png
what i would like:
Code: Select all
FIND="/"
ADD="/root"
sed -i '/\$FIND/s/^/\$ADD/'