[2013-04-02 15:23] Sam Watkins <s...@nipl.net>
> 
> 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.

Please don't write this tool as it is already available: ed(1):

echo '1,$-6p' | ed - "$1"
echo '10,$--p' | ed - "$1"

Better learn about software leverage!


meillo

Reply via email to