Hi All,

This took me an very frustrating hour to figure out.  Especially
since I was looking for something like awk's "-F" command.

I hope this save someone else from pulling their hair out!
(I was trying to do a substitution with a ton of forward slashes
in it from a variable.   AAAAHHHHH!!!!!)

-T



Example of substitute example:


$ echo "$(echo "TRUE" | sed -e 's/TRUE/FALSE/g')"
FALSE

"g" is for "global"



Example with variables (use full quotes):

$ X="abcd"
$ Y="xyz"
$ echo $X | sed -e "s/${X}/${Y}/"
xyz


If a variable uses a "/" inside it, use a different "delimiter" (the
first character after the "s" tells sed what the delimiter is):


$ X="./abcd"
$ Y="./xyz"
$ echo $X | sed -e "s|${X}|${Y}|"
./xyz

Reply via email to