LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 10-13-2014, 08:45 AM   #1
jhonson31
LQ Newbie
 
Registered: Oct 2014
Posts: 1

Rep: Reputation: Disabled
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
 
Old 10-13-2014, 09:11 AM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
see the relevent man pages this is basic stuff so come on put a bit of effort into it
 
Old 10-13-2014, 09:43 AM   #3
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,137
Blog Entries: 6

Rep: Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] head and tail dont seem to work oraenthu@live.com Linux - Newbie 14 03-26-2014 02:53 PM
How to read 2nd to last line using head or tail command techie_san778 Linux - Server 7 09-29-2013 08:09 AM
[SOLVED] "tail -n 1 filename" error while "head -n 1 filename" is ok? type8code0 Linux - Newbie 3 03-21-2011 06:10 AM
[SOLVED] Tail/head JJ Linux Linux - Newbie 4 02-11-2011 10:06 AM
tail +40 /etc/FILENAME newbie_mel Linux - Software 1 03-20-2006 06:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration