problem with tail -3540

peterson at milano.UUCP peterson at milano.UUCP
Sat Sep 20 03:53:19 AEST 1986


In article <917 at gilbbs.UUCP>, mc68020 at gilbbs.UUCP (Thomas J Keller) writes:
> 
> I typed:
> 
> tail -3540 history > newhist
> 
> what I get is the last 72.? lines of history.  ... the
> output file is *ALWAYS* 4096 bytes in length.

If you look at the man page for tail under "Bugs", it says:

"Tails relative to the end of the file are treasured up in a buffer,
and thus are limited in length"

Looking at the code, what that means is that tail allocates a buffer
of 4096 bytes and reads the last 4K bytes into it.  It then counts
lines from the end of the buffer until (1) it has found the desired
number of lines or (2) it reaches the front of the buffer.  It then
prints this part of the buffer.  Since the buffer size if 4K, tail
will never print more than 4K bytes.
-- 
James Peterson
peterson at mcc.com  or  ...sally!im4u!milano!peterson



More information about the Comp.unix mailing list