Bug 216729 - tail -Nf syntax doesn't work anymore with multiple files
Summary: tail -Nf syntax doesn't work anymore with multiple files
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: coreutils
Version: 5.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Tim Waugh
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-11-21 18:38 UTC by William Yardley
Modified: 2007-11-30 22:07 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-11-22 10:38:16 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description William Yardley 2006-11-21 18:38:37 UTC
Description of problem:

Not sure if this is a bug - may just be to deal with vague syntax, but to me, it
seems like it should work.

The following syntax used to work with tail:

tail -5f /www/logs/access_log /www/logs/error_log

now I get:
tail: invalid option -- 5

I can still do either:

tail -f /www/logs/access_log /www/logs/error_log

(to tail both log files)

or:
tail -5f /www/logs/access_log

(works with just one file)

I'd think since the "-Nf" syntax works with one file, it should work 
with multiple files as well (tailing 5 lines of each).

It does work if I do:
"tail -f --lines=5 /www/logs/access_log /www/logs/error_log"

Version-Release number of selected component (if applicable):
charlie-web1:$ rpm -qf `which tail`
coreutils-5.97-6
charlie-web1:$ cat /etc/redhat-release 
Red Hat Enterprise Linux Client release 4.91 (Tikanga)

How reproducible:
Very

Steps to Reproduce:
see above

Comment 1 Jim Meyering 2006-11-22 07:30:20 UTC
Thanks for the report.  I can see how you'd think "tail -5f" should work for any
number of arguments >= 1, but using a "-5" option (rather than "-n 5") puts your
usage in GNU tail's "obsolete, maintain only bare minimum of support with
legacy" mode.  And legacy versions of tail-with-f only ever worked with a single
file.

Comment 2 William Yardley 2006-11-22 08:37:04 UTC
(In reply to comment #1)
> And legacy versions of tail-with-f only ever worked with a single
> file.

Well it's always worked w/ RHEL3, and seems to also work with RHEL4 (see below).
That syntax also works fine on FreeBSD's "tail", and with the version of tail
distributed with Debian 3.1 (5.2.1-31). It seems very inconsistent that it now
works when there is one file as an argument, but not with multiple files.

I already updated the thing I had which called tail this way, so it's not a big
deal to me if you want to close this... it's just kind of irritating.

triton:$ tail -5f /www/logs/error_log /www/logs/access_log.1164153600
==> /www/logs/error_log <==
[ 5 more lines ]

==> /www/logs/access_log.1164153600 <==
[ 5 more lines ]

triton:$ rpm -qf `which tail`
coreutils-4.5.3-28.4
triton:$ cat /etc/redhat-release 
Red Hat Enterprise Linux WS release 3 (Taroon Update 8)


nahant64:$ sudo tail -5f /var/log/messages /var/log/mysqld.log
==> /var/log/messages <==
[ 5 lines ]

==> /var/log/mysqld.log <==

nahant64:$ rpm -qf `which tail`
coreutils-5.2.1-31.4
nahant64:$ cat /etc/redhat-release 
Red Hat Enterprise Linux WS release 4 (Nahant Update 4)

Comment 3 Tim Waugh 2006-11-22 10:38:16 UTC
'tail -n5 -f' is what you want to use.  The 'tail -5' syntax has been deprecated
for quite a while.


Note You need to log in before you can comment on or make changes to this bug.