Matthew Woehlke <address@hidden> wrote:
> Well, yes, I would hope so. If you can't write 'a + b' in your program,
> something is wrong ;-). (Use case is of course e.g. scripts where the
> beginning line is not known in advance, but you know you want N lines
> total.)
Am I right assuming you mean something like '-20,+3' ?
> '-N' is already a fairly common convention, so I don't expect problems.
> And I stole '+N' from sed, of course :-).
OK.
> Ok. (An alternative, if sed-like format wins, would of course be '5,$',
> but '5,-0' is fine.)
I'm a bit hesitant to make it look too much like sed.
And I must correct myself here: "1,-1" is valid, whereas "1,-0" isn't.
> I was asking you :-). Personally I think printing lines backwards is
> probably not so good an idea, so I would either match only the first
> line, or else print a warning to stderr.
I think we should disallow it entirely. Worry later about the details.
> Anyway '5,2' was just an
> "obvious" example; I would expect this to be more likely with a range
> like '5,-5' on input with fewer than nine lines.
Agreed (except s/nine/ten/).