sed 's/foobar/$string/g'.... can't do this?
Tom Christiansen
tchrist at convex.COM
Fri Feb 1 11:05:57 AEST 1991
>From the keyboard of gwc at root.co.uk (Geoff Clare):
:})
:})Xstring=`sed 's/[\/&\\]/\\&/g' <<!
:})$string
:})!
:})`
:})sed 's/foobar/'"$Xstring"'/g'
:
:}Did you actually try your solution? I guess not.
:
:}The following works:
:
:}Xstring=`sed 's/[\/&\\\\]/\\\\&/g' <<!
:}$string
:}!
:}`
Gotta love these languages where the backslashes just keep building
until almost that's all there is. Reminds me of writing troff macros.
Just keep adding backslashes until it works. :-)
--tom
--
"Hey, did you hear Stallman has replaced /vmunix with /vmunix.el? Now
he can finally have the whole O/S built-in to his editor like he
always wanted!" --me (Tom Christiansen <tchrist at convex.com>)
More information about the Comp.unix.shell
mailing list