Re: [dev] print utility

From: Sam Watkins <sam_AT_nipl.net>
Date: Tue, 2 Apr 2013 15:23:51 +1100

On Sat, Mar 30, 2013 at 10:27:05PM -0400, Calvin Morrison wrote:
> Is there a better way to read a whole line?

For this tool you don't need to read whole lines, just read blocks and
count newlines until you perhaps get to the right line number, and print
everything the next newline.

I agree that sed and awk are somewhat monsterous.

I suggest to extend your program so it can also print a range of lines
(and thus subsume the functions of 'head' and 'tail' while doing more
and yet staying fairly focused). You could perhaps use negative numbers
to count back from the final line. It should be able to cut off 6 lines
from the end of a file, or print from lines 10 through to the 2nd-last line.

Ideally lines should be numbered from zero, and ranges exclude the upper
limit, but that might make things weird for humans!
Received on Tue Apr 02 2013 - 06:23:51 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 02 2013 - 06:36:03 CEST