Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
10-22-2008, 12:46 PM
|
#1
|
LQ Newbie
Registered: May 2008
Posts: 15
Rep:
|
tail: cannot open `+5' for reading: No such file or directory
Hello,
I have a simple script that runs well on other linux but not on my new RHEL v5. It says:
"tail: cannot open `+5' for reading: No such file or directory"
The line causes the trouble is:
cat XYZ.poscar | tail +5 | awk '{printf("%4s%6s%4s\n",$5, $6, $4)}' > types_
I appreciate any help.
Michael
|
|
|
10-22-2008, 12:54 PM
|
#2
|
Senior Member
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288
Rep:
|
What are you trying to do?
Forrest
|
|
|
10-22-2008, 12:58 PM
|
#3
|
Member
Registered: Nov 2007
Location: Virginia
Distribution: Fedora, RHEL, CentOS
Posts: 67
Rep:
|
|
|
|
10-22-2008, 01:05 PM
|
#4
|
Senior Member
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288
Rep:
|
I'm guessing it should be:
Code:
tail -5 XYZ.poscar | awk '{printf("%4s%6s%4s\n",$5, $6, $4)}' > types_
But since I don't know what he's trying to do, I cant really say. Perhaps +5 is a valid option to tail on some flavour of Linux I've not used.
Forrest
|
|
|
10-22-2008, 01:07 PM
|
#5
|
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509
|
The tail +N syntax is obsolete and it's not accepted on some systems. Instead, you have to use the option -n explictly:
or eventually you can specify an older POSIX standard in your environment. You can do this by defining the environment variable _POSIX2_VERSION, for example by using the env command:
Code:
env _POSIX2_VERSION=199209 tail +5 XYZ.poscar | awk ...
this force to run the tail command conformed to POSIX 1003.2-1992.
|
|
|
10-22-2008, 01:10 PM
|
#6
|
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509
|
Quote:
Originally Posted by forrestt
Perhaps +5 is a valid option to tail on some flavour of Linux I've not used.
|
Yes. The +N option means "show the last lines of the file starting from the Nth line" instead of the default 10 lines.
|
|
|
10-22-2008, 01:16 PM
|
#7
|
Senior Member
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288
Rep:
|
So, then it should be:
Code:
awk 'NR>4 {printf("%4s%6s%4s\n",$5, $6, $4)}' > types_
HTH
Forrest
|
|
|
10-22-2008, 01:16 PM
|
#8
|
LQ Newbie
Registered: May 2008
Posts: 15
Original Poster
Rep:
|
Thank you all for such prompt replies. The option "tail -n +5" really works.
Michael
|
|
|
All times are GMT -5. The time now is 07:13 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|