| Newsgroups |
gmane.editors.sed.user |
| Message-ID |
<[email protected]> |
Hi,
"Is the /e (evaluate) option to the s/// command a new addition to sed? And when the expr command is evaluated the very first time, the value of & is null. Is that promoted to a numeric zero when run thru expr?" Yes, the e flag for the s command is a GNU extension. So it perhaps just works with GNU sed.
I was also wondering about how the expr command handles the first time. To my understanding, the first time, "nothing" is substituted, so the following executes, which ends up resulting in 1 (though I don't know exactly why):
$ expr + 1
1
To make it clearer - so it results in "expr 0 + 1" - the hold space could of course be initialized with 0 at the top of the script, something like.
1 {x; s/.*/0/; x}
Daniel
[Non-text portions of this message have been removed]