sed help

Robert Connolly cendres at videotron.ca
Sat Jan 31 21:00:45 PST 2004


I know this isn't linux-help, but I've asked around a lot and can't seem to 
straiten this out.

export foo="*a*" bar="*b*" && echo 'blah *a* blah' | sed 's;$foo;$bar;'

I need a way to let $foo expand without using *'s as wildcards.
More specificly I want to replace this:

< %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:    %(linker) %l %{pie:-pie} %X %
{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}    %{s} %{t} %{u*} %{x} %{z} %{Z} %
{!A:%{!nostdlib:%{!nostartfiles:%S}}}    %{static:} %{L*} %(link_libgcc) %o %
{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}}    %{!A:%{!nostdlib:%
{!nostartfiles:%E}}} %{T*} }}}}}}

With this:

> %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:    %(linker) %l %{!nopie: %
{!static: %{!D__KERNEL__: %{!DIN_GCC: %{!nostartfiles: %{!nodefaultlibs: %
{!nostdlib: %{!nostdinc: %{!shared: %{!Bshareable: %{!i: %{!r: 
-pie} } } } } } } } } } } } %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}    %
{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}    %
{static:} %{L*} %(link_libgcc) %o %{!nostdlib:%{!nodefaultlibs:%
(link_gcc_c_sequence)}}    %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %
{T*} }}}}}}

Maybe I can use something other than sed? (not patch)

Another example of what I'm trying to get is this:

export foo="*a*" bar="*b*" && echo 'blah *a* blah' | sed 's/\`echo $foo`/
\`echo $bar`/'

Ignore wildcards but let $foo and $bar expand.




More information about the lfs-dev mailing list