[lug] is sed broken?

D. Stimits stimits at idcomm.com
Mon Jul 15 13:46:48 MDT 2002


Rob Judd wrote:
> 
> > 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 ... ?

Yes I do, but due to the nature of the file, no more than one
token=value pair will exist per line. If more than one does exist, it is
already broken.

D. Stimits, stimits at idcomm.com



More information about the LUG mailing list