Bug 216729 - tail -Nf syntax doesn't work anymore with multiple files
tail -Nf syntax doesn't work anymore with multiple files
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: coreutils (Show other bugs)
5.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-11-21 13:38 EST by William Yardley
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-11-22 05:38:16 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description William Yardley 2006-11-21 13:38:37 EST
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 02:30:20 EST
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 03:37:04 EST
(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 05:38:16 EST
'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.