[lug] is sed broken?

D. Stimits stimits at idcomm.com
Sat Jul 13 20:18:22 MDT 2002


Thanks, this was it, the shell was doing its own thing first, the single
quote worked.

D. Stimits, stimits at idcomm.com

Tom Tromey wrote:
> 
> >>>>> ">" == D Stimits <stimits at idcomm.com> writes:
> 
> >> For regular expression, where bar is unkown, but foo is known, normally
> >> I would think that I could use this:
> >>   foo[=]["].*["]
> 
> Yes, though you don't need the []:
> 
>     foo=".*"
> 
> is a valid sed regexp.
> 
> >> My sed is similar to:
> >>   cat some.file | sed "s/foo[=]["].*["]/foo="new_value"/" -
> 
> You're experiencing a sed/sh quoting interaction problem.
> Use single quotes around the sed expression and you'll be ok.
> This worked for me:
> 
>     fleche. cat /tmp/X
>     foo="bar"
>     fleche. sed 's/foo=".*"/foo="new_value"/' < /tmp/X
>     foo="new_value"
> 
> Tom
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug



More information about the LUG mailing list