tail issue!

Hi,

I had few scripts which were running fine on linux:

uname -a
Linux ######### 2.6.9-89.ELsmp #1 SMP Mon Apr 20 10:33:05 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

from some front end application. Recently there was a migration of this application on some other linux m/c:

 
uname -a
Linux #########  2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

after which scripts having code lines as follows fails!!

 
cat <file name> | tail +2
tail: cannot open `+2' for reading: No such file or directory

I don't know why this is happening. Can anybody please suggest?

-dips

cat <file name> | tail -2

tail with + option is not available on every linux/unix,

use

sed 1d

instead

Per POSIX:
The plus sign is obsolescent and was supported only for wide character applications.

You have a newer kernel, along with a newer version of GNU coreutils, it is interpreting the +2 as a file name since it thinks that options only begin with the "-" character.

Try:

tail -n +2 
1 Like

Jim,
Thanks for explanation.