LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   can anybody explain this please... head -n FILENAME | tail -1 (https://www.linuxquestions.org/questions/linux-newbie-8/can-anybody-explain-this-please-head-n-filename-%7C-tail-1-a-4175521963/)

jhonson31 10-13-2014 08:45 AM

can anybody explain this please... head -n FILENAME | tail -1
 
hi a am a total newbie to linux n cli, can anybody explain this please...

head -n FILENAME | tail -1

&

sed -n "FILENUMBERp" filename


please be detailed in your answers.... I will be thankful

Keith Hedger 10-13-2014 09:11 AM

see the relevent man pages this is basic stuff so come on put a bit of effort into it

teckk 10-13-2014 09:43 AM

man head
man tail
man sed, if you have it installed

Also online at
http://linux.die.net/man/1/head
http://linux.die.net/man/1/tail
http://linux.die.net/man/1/sed

So head -n FILENAME gets the first -n lines of a FILENAME.
tail gets the last lines.

sed is a stream editor.
https://www.gnu.org/software/sed/manual/sed.html
http://sed.sourceforge.net/sed1line.txt


All times are GMT -5. The time now is 01:28 AM.