bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] linecut addition


From: Matthew Woehlke
Subject: Re: [RFC] linecut addition
Date: Tue, 09 Oct 2007 14:00:58 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.0

Steven Schubiger wrote:
Matthew Woehlke <mw_triad.NO.SPAM.PLEASE> wrote:

Do you plan to have a means of specifying a number of lines? E.g.:

$ seq 10 | linecut --range 5,+3
5
6
7

I like the idea. And it should be rather easy to calculate the
ending line position.

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.)

I hope the distinction between the '-' & '+'
"prefixes" would be clear enough.

'-N' is already a fairly common convention, so I don't expect problems. And I stole '+N' from sed, of course :-).

Btw, how do you match 5 through end? '5,-0'?

Yes.

Ok. (An alternative, if sed-like format wins, would of course be '5,$', but '5,-0' is fine.)

What does a reversed range (e.g. '5,2') match?

That shouldn't be allowed. Or should it?

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. 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.

--
Matthew
morphir: so much confusion :S kmake, kdemake, qmake make cmake etc.
logixoul: you forgot cmakekde :)
morphir: and bakemeacake





reply via email to

[Prev in Thread] Current Thread [Next in Thread]