[lug] is sed broken?

Rob Judd rjudd at mlug.missouri.edu
Sun Jul 14 19:11:34 MDT 2002


> I'm trying to grep for this kind of sample line:
> foo="bar"
>
> For regular expression, where bar is unkown, but foo is known, normally
> I would think that I could use this:
>   foo[=]["].*["]
>
> Or else with some form of escape notation for the quotes, e.g.:
>   foo[=]\".*\"
>
> My goal is to replace the quoted part with a different word, e.g., turn:
>   foo="abc"
> ...into:
>   foo="xyz"

By the way, you do realise that the pattern s/fu=".*"/fu="new_value"/ will
match the line
fu="bar" fred="nothing"
and change it to
fu="new_value"
silently dropping the second variable/assignment ... ?

Rob




More information about the LUG mailing list