LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to make newer "tail" behave like older "tail" (https://www.linuxquestions.org/questions/linux-software-2/how-to-make-newer-tail-behave-like-older-tail-604661/)

rylan76 12-05-2007 07:35 AM

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...

matthewg42 12-05-2007 07:45 AM

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.

colucix 12-05-2007 08:29 AM

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.

rylan76 12-07-2007 03:05 AM

THANKS!!!!!

That last one was the key - much obliged!

:)

colucix 12-07-2007 04:27 AM

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.


All times are GMT -5. The time now is 08:51 PM.