Help with sed script?
Ben Scott
dragonhawk at gmail.com
Wed Sep 6 11:01:01 EDT 2006
This got sent to the wrong address.
---------- Forwarded message ----------
From: David J Berube <djberube at berubeconsulting.com>
Date: Sep 6, 2006 9:43 AM
Subject: Re: Help with sed script?
To: GNHLUG Organization <gnhlug-org at mail.gnhlug.org>
It does, but if it can't find a match, it will backtrack.
David Berube
Berube Consulting
djberube at berubeconsulting.com
(603)-485-9622
http://www.berubeconsulting.com/
Michael ODonnell wrote:
> 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.
>
> _______________________________________________
> gnhlug-discuss mailing list
> gnhlug-discuss at mail.gnhlug.org
> http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss
>
>
_______________________________________________
gnhlug-org mailing list
gnhlug-org at mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-org
More information about the gnhlug-discuss
mailing list