LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Solaris / OpenSolaris (https://www.linuxquestions.org/questions/solaris-opensolaris-20/)
-   -   tail -n+20 server.log in Solaris? (https://www.linuxquestions.org/questions/solaris-opensolaris-20/tail-n-20-server-log-in-solaris-4175468151/)

thomas2004ch 07-02-2013 07:14 AM

tail -n+20 server.log in Solaris?
 
Hi,

The following command I use in RedHat-Linux
Code:

tail -n+20 server.log
will get error by Solaris as follow
Code:

usage: tail [+/-[n][lbc][f]] [file]
      tail [+/-[n][l][r|f]] [file]

How can I correct it?

druuna 07-02-2013 07:24 AM

Have you tried:
Code:

tail -20 server.log

thomas2004ch 07-02-2013 07:59 AM

I use the tail +20 server.log now.

Tail -20 is different from tail +20

druuna 07-02-2013 08:09 AM

Just remembered something: Which tail executable are you using?

If I recall correctly the /usr/xpg4/bin/tail version has the same options as the linux version.

If that is the case then the following should work:
Code:

/usr/xpg4/bin/tail -n+20 server.log
And in case that doesn't work, you could use sed to produce the same result:
Code:

sed -n '5,$p' server.log


All times are GMT -5. The time now is 12:49 AM.