On 07/06/19 21:26, Jon Hart wrote:
> I have a file that does yet exist, but when it does finally exist I want to
> skip the first line and follow the remainder of the file.  tail -F -n +2
> should do this, however it does not skip the first line -- it starts
> printing at the first line.
> 
> In one shell, fire up tail on a file that does not yet exist and tell it to
> start printing at the second line:
> 
> $ tail -F -n +2 /tmp/does_not_exist
> tail: cannot open '/tmp/does_not_exist' for reading: No such file or
> directory
> 
> In another shell, write several lines to the non-existent file:
> 
> $  echo -e "line1\nline2\nline3" > /tmp/does_not_exist
> 
> Now see that tail printed out all three lines rather than skipping the
> first:
> 
> tail: '/tmp/does_not_exist' has appeared;  following new file
> line1
> line2
> line3
> 
> 
> tail/coreutils 8.28
> 
> I don't see anything in the help that hints at what might be happening
> here.  Smells like a bug.  Can anyone else confirm?

Well really -n is ignored when files are replaced.
I.E. -F will just dump the entire file when it's been detected as replaced.
Consider subsequent replacements of the file.
You wouldn't want --lines=NUM to be honored on each replacement.

Now maybe we could treat --lines=+NUM specially, and honor on each replacment,
assuming it's skipping a header or something. Though that sounds too
special case to be done by the current options at least.

cheers,
Pádraig

Reply via email to