LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 12-05-2007, 07:35 AM   #1
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,475

Rep: Reputation: 87
How to make newer "tail" behave like older "tail"


Hi guys

How can I make my "tail" binary in a FC6 install, which takes this parameter

tail -n +486

behave like an older version of tail, i. e. where I can just specify

tail +486

to get the same result from the "newer" tail on FC6 as the old syntax would have elicited??

Thanks...
 
Old 12-05-2007, 07:45 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
I thought the old style was like this, "tail -486", not using a + character. I believe this still works with the GNU tools version of tail.
 
Old 12-05-2007, 08:29 AM   #3
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,506

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Actually, the old-style option was +N to print out lines from N-th to the end. The new-style option does not permit it anymore, even if -N can still be used. However you can force tail to conform to the old POSIX standard, by setting the following environment variable
Code:
export _POSIX2_VERSION=199209
I don't know how this affects other commands, anyway. You can try to look for more detailed informations on the coreutils site.
 
Old 12-07-2007, 03:05 AM   #4
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,475

Original Poster
Rep: Reputation: 87
THANKS!!!!!

That last one was the key - much obliged!

 
Old 12-07-2007, 04:27 AM   #5
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,506

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
You're welcome! To be sure, you can avoid problems with other commands by creating an alias for tail
Code:
alias tail='_POSIX2_VERSION=199209 tail'
in this way the variable _POSIX2_VERSION will be set only for the execution of tail.
 
  


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
how to stop "tail -f" in scipt? jimmyjiang Red Hat 16 06-30-2010 08:43 AM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 08:31 AM
Howto end the "tail" command??? Schmurff Linux - Newbie 5 03-03-2004 05:32 AM
Error in Sendmail Tail : "apache set sender to <> using -f" cartfanatic39 Linux - Software 0 01-30-2004 10:04 AM


All times are GMT -5. The time now is 12:54 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