LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Help with 'tail' command! (https://www.linuxquestions.org/questions/linux-software-2/help-with-tail-command-167223/)

Beppe83 04-07-2004 04:57 AM

Help with 'tail' command!
 
Hi all.

I'm writing a simple bash script, and I need help with the 'tail' command; ok first of all I execute the 'ls' command and I pipe it to the 'tail' one with this option '-n N' where N is the number of lines I want to display.

Now the point is the I need the FIRST N lines and not the LAST ones; I read in the 'man' of tail that if I use '+' before the number of lines I want to see. It doesn't work. Here it is:

ls -l | tail -n +5

Ok, this is not running. Anyone can help?

Thanx!

Gnuru 04-07-2004 06:00 AM

Try this:

Code:

ls -l | tac | tail -n 5

hw-tph 04-07-2004 06:05 AM

Or just use head instead of tail (sounds like the beginning of a bad joke but it isn't :))


Håkan

Beppe83 04-07-2004 08:11 AM

Thank you!


All times are GMT -5. The time now is 01:27 PM.