Help with sed script?
Michael ODonnell
michael.odonnell at comcast.net
Wed Sep 6 08:53:01 EDT 2006
Hmmmm. I'd heard that sed's RE parser is a type known as
"greedy" meaning that every expression matches the longest
possible string in the input. I therefore can't understand
how after all the leading whitespace has been matched there
can be any whitespace "left over" to match the not-a-hashmark
expression, but apparently there is. Anyway, changing that part
to be not-a-hashmark-or-whitespace seems to solve the problem:
sed -r -e '/^[[:space:]]*[^#[:space:]].*[[:space:]]+xyz[[:space:]]*/{s/^.*$/REWRITTEN/}'
My thanks to all for the feedback.
More information about the gnhlug-discuss
mailing list