Bug#475464: sed: lost cycle in address range with last-line-address operation

2008-04-12 Thread Oleg Verych
> Then, "ADDR,$" you're right that could be optimized, unlike "$" or "$!". > That's a separate feature request. I'd say it is consistency not optimization. Anyway thanks for feedback! -- sed 'sed && sh + olecom = love' << '' -o--=O`C #oo'L O <___=E M -- To UNSUBSCRIBE, email to [EMAIL PROTE

Bug#475464: sed: lost cycle in address range with last-line-address operation

2008-04-12 Thread Paolo Bonzini
Is it about how you do recognize last line before script gets to the end, i.e. '$' is next-to-last read() without EOF? Yes. And that "next-to-last" bit is what forces sed to do its lookahead. In the corner case if the line was read and then network connection was dropped ... you don't care,

Bug#475464: sed: lost cycle in address range with last-line-address operation

2008-04-11 Thread Oleg Verych
Paolo Bonzini @ Fri, Apr 11, 2008 at 8:06 AM: > > 'if EOF || Error' or 'if ! read-is-OK' > > > > Latter applies for ordinary files also, no? No need of look ahead. > > > > This is the next-to-last line, not the last line. sed does test for it, > but because the result would be off-by-one, it has

Bug#475464: sed: lost cycle in address range with last-line-address operation

2008-04-11 Thread Paolo Bonzini
'if EOF || Error' or 'if ! read-is-OK' Latter applies for ordinary files also, no? No need of look ahead. This is the next-to-last line, not the last line. sed does test for it, but because the result would be off-by-one, it has to look ahead one line. in interactive or line-by-line exam

Bug#475464: sed: lost cycle in address range with last-line-address operation

2008-04-11 Thread Oleg Verych
Hallo, Paolo. > > Example: 'cycle 3' == 'first address 3' is lost: > > > > Not a bug. sed starts a one-line lookahead behavior when $ is used. Which is on useless pipes. Last-line for them can be 'if EOF || Error' or 'if ! read-is-OK' Latter applies for ordinary files also, no? No need of loo

Bug#475464: sed: lost cycle in address range with last-line-address operation

2008-04-10 Thread Paolo Bonzini
Oleg Verych wrote: Package: sed Version: 4.1.5-1 Severity: normal Example: 'cycle 3' == 'first address 3' is lost: Not a bug. sed starts a one-line lookahead behavior when $ is used. You're right this is unnecessary for ADDR1,$ but it does not cause wrong behavior -- the output is correct.

Bug#475464: sed: lost cycle in address range with last-line-address operation

2008-04-10 Thread Oleg Verych
Package: sed Version: 4.1.5-1 Severity: normal Example: 'cycle 3' == 'first address 3' is lost: [EMAIL PROTECTED] (while echo -n IN:>&2 && read A; do echo "$A"; sleep 1; done) | sed 'x ; G ; 3,$s ^ | ; h' IN:1 1 IN:2 1 2 IN:3 IN:4 | 1 2 3 IN:5 || 1 2 3 4 IN: [EMAIL PROTECTED] A