Steven Schubiger <[EMAIL PROTECTED]> wrote: > Jim Meyering <[EMAIL PROTECTED]> wrote: > >> Before coding further, I strongly urge you to nail down the >> specification -- publicly. Put it this way: write enough >> details that someone reading your description in a man page >> would not be disappointed. > > DESCRIPTION > > linecut extracts slices of lines from either a file/stream > or multiple files. > > The required range parameter provided must consist of at > least one pair of a line slice, where the line to > start from preceeds the comma and the line to end > at follows the comma. The line specified may be absolute > counting from the beginning of the file (positive number) > or relative to the end (negative number). Absolute and > relative line positions may be intermixed. > > If more than one pair of a line slice is provided, then > the pairs must be separated by a colon. > > The line-numbering parameter works similar to cat and > is optional. > > EXAMPLES > > (line 2-5) > $ seq 10 | linecut --range 2,5 > 2 > 3 > 4 > 5 > > (line 2-2nd last line) > $ seq 10 | linecut --range 2,-2 > 2 > 3 > 4 > 5 > 6 > 7 > 8 > 9 > > (6th last line-2nd last line) > $ seq 10 | linecut --range -6,-2 > 5 > 6 > 7 > 8 > 9 > > (line 2-4, 3rd last line-last line) > $ seq 10 | linecut --range 2,4:-3,-1 > 2 > 3 > 4 > 8 > 9 > 10 > > I've omitted the line-numbering examples, since the > line numbers printed would equal the extracted sequences.
That's a good start, but please elaborate on the following, too: What if ranges overlap? I.e., --range 1,5:4,8 Bear in mind that with an EOF-relative endpoint, we can't even know whether two ranges overlap until after reading to end of file. What if one range is contained within another? What if they are out of order, e.g. --range 4,7:1,3 ? You don't say whether line numbering restarts with multiple input files. I presume not, but the spec/manual should specify. A note about notation. I'm used to seeing ":" or "-" between the endpoints of a range, not ",". "," is more often the separator *between* ranges. Please consider using a more conventional notation. _______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
