Hi Antonio, Not seeing anyone else respond I thought I would make a comment.
Antonio Diaz Diaz wrote: > I was fixing the ',,' address bug reported by Matthieu Felix when I > found what I think is an error in the POSIX page for ed: I think you did too. > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ed.html > > Address Addr1 Addr2 > 7,+ 7 8 > 7;+ 7 8 > > The first row should be equivalent to '7,.+', not to '7,8'. Or is this one > of those historical quirks of ed? The 7,+ address range is a state dependent range AFAIK. It depends upon the previous value state of dot. If dot is 7 then the address range is 7,8 because + by itself is the same as .+1 setting dot to 8. But if dot is, say, 3, then 7,+ is the same as 7,4 which will print line 4 due to the default action of using the last address if only one is expected. Therefore the Addr2 column for 7,+ should say ".+1". Saying 8 there is definitely not correct. I know you know all of this following. I am simply being verbose for the email archive. Using the Unix v7 ed sources to verify the traditional Unix ed behavior let me poke around the corners a little bit. $ seq 10 | sed 's/^/line /' > numbers.txt $ v7ed numbers.txt 71 .= 10 7,+ ? That error ('?') is expected because 7,11 is the same as 11 and that is beyond the end of the file. 3 line 3 .= 3 7,+ line 4 .= 4 Seeing 7,+ is so odd because it depends upon the previous value of dot. 7 line 7 7,+ line 8 7,+ line 9 7,+ line 10 7,+ ? Again it is moving dot along each time. Which I had not realized before but I guess can be used like this contrived example. /pattern2/ ?pattern1/,++s/foo/bar/ The /pattern2/ will set dot and then the ?pattern1? will be addr1 and ++ will be the dot (from pattern2) plus two lines as a range for the command. To exercise it with the test file: /line 7/ line 7 ?line 3?,++p line 3 line 4 line 5 line 6 line 7 line 8 line 9 However all of the above is the Unix v7 ed. I don't have easy access to a SysV version of ed to test the above corners on but I think it likely that it behaves the same way for this. Hope this helps! Bob _______________________________________________ bug-ed mailing list bug-ed@gnu.org https://lists.gnu.org/mailman/listinfo/bug-ed