LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.

Notices

Reply
 
Search this Thread
Old 07-02-2013, 07:14 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 497

Rep: Reputation: 31
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?
 
Old 07-02-2013, 07:24 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Have you tried:
Code:
tail -20 server.log
 
Old 07-02-2013, 07:59 AM   #3
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 497

Original Poster
Rep: Reputation: 31
I use the tail +20 server.log now.

Tail -20 is different from tail +20
 
Old 07-02-2013, 08:09 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
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

Last edited by druuna; 07-02-2013 at 08:10 AM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
convert LAN IP address to Host Name when I give cmd tail -f /var/log/squid/access.log rs15 Linux - Networking 6 01-22-2012 01:45 AM
[SOLVED] /usr/bin/tail -n does not work in solaris 5.9 sreesree Solaris / OpenSolaris 5 11-28-2011 06:30 AM
tail + option in solaris and linux amv Linux - Newbie 4 09-08-2010 12:13 AM
Perl or PHP Script that can tail /var/log/auth.log - two-factor authentication tdnnash25 Linux - Server 1 06-18-2009 08:36 PM
tail -$NUM log chrisk5527 Linux - General 1 06-30-2004 09:02 AM


All times are GMT -5. The time now is 11:45 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration