| Newsgroups |
gmane.editors.sed.user |
| Message-ID |
<[email protected]> |
On 2015-03-05 21:18, 'Seeger, Stephan' wrote:
> @Tim: Thank you for your detailed explanation - now I see a whole
> lot clearer. Really looks like an awesome hack compared to the
> variants seen on the internet. Also it seems to be a completely new
> invention when even the sed FAQ at sourceforge i.e. 4.24 doesn't
> mention anything alike...probably they should extend them now. From
> your description I conclude that the statement must be fairly
> robust and portable or do you think any of the logic it relys on
> will be changed/ unavailable in some sed version.
The biggest factor that would change predictability is whether a
version of sed is optimized to just check the start-pattern, or if it
checks both the start- and end-pattern before executing the action.
GNU sed apparently just checks the start-pattern, so the
last-used-pattern doesn't get changed by the end-pattern. Unless the
POSIX specs mandate that, it's possible that an alternate sed could
check both the start- and end-patterns, thus changing the behavior
and breaking this fun little stunt.
-tim