LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   tail + option in solaris and linux (https://www.linuxquestions.org/questions/linux-newbie-8/tail-option-in-solaris-and-linux-830773/)

amv 09-07-2010 07:25 AM

tail + option in solaris and linux
 
Hi All

I have a file with contents as
Line 1
Line 2
Line 3
Line 4
Line 5


In Solaris, tail command is working as
tail +1 test ---> tailing whole file
Line 1
Line 2
Line 3
Line 4
Line 5


tail +2 test --->skipping first line and tailing restLine 2
Line 3
Line 4
Line 5



But when I try the same in Linux RHEL 3.4, I am getting below

tail +1 test
tail: cannot open `+1' for reading: No such file or directory
==> test <==
Line 1
Line 2
Line 3
Line 4
Line 5


tail +2 test
tail: cannot open `+2' for reading: No such file or directory
==> test <==
Line 1
Line 2
Line 3
Line 4
Line 5




Any idea? Any alternative in LInux??

Regards
AMV

ghostdog74 09-07-2010 07:33 AM

its tail -n +2

sem007 09-07-2010 07:40 AM

use tail -n +NUM file name

This behavior is documented in /usr/share/doc/coreutils-*/NEWS


Code:

A few usages still have behavior that depends on which POSIX standard is
  being conformed to, and portable applications should beware these
  problematic usages.  These include:

    Problematic      Standard-conforming replacement, depending on
      usage            whether you prefer the behavior of:
                      POSIX 1003.2-1992    POSIX 1003.1-2001
    sort +4          sort -k 5            sort ./+4
    tail +4          tail -n +4          tail ./+4
    tail - f          tail f              [see (*) below]
    tail -c 4        tail -c 10 ./4      tail -c4
    touch 12312359 f  touch -t 12312359 f  touch ./12312359 f
    uniq +4          uniq -s 4            uniq ./+4


amv 09-07-2010 11:47 PM

Many Thanks.. Now it is clear..

Regards
AMV

quanta 09-08-2010 12:13 AM

If you have similar questions at the next time, you should read the manpage to find out the answer for yourself:
Code:

-n, --lines=K
              output the last K lines, instead of the last 10; or use +K to output lines starting with the Kth



All times are GMT -5. The time now is 09:16 PM.