How to extract the second row of a text-file?

Showing Answers 1 - 1 of 1 Answers

gto mitbbs

  • Jun 10th, 2007
 

tail +2 <filename> | head -1

Subramanyam

  • Jun 20th, 2007
 

head -2 filename|tail -1

aamer123

  • Jul 9th, 2007
 

 sed -n '2p' datafile

srinu

  • Jul 16th, 2011
 

head -2 | tail -1

  Was this answer useful?  Yes

Furkan

  • Mar 30th, 2012
 

cut -d -f2

  Was this answer useful?  Yes

Debi Maharana

  • Apr 7th, 2012
 

awk NR==

  Was this answer useful?  Yes

vijay

  • Jun 21st, 2012
 

sed -n 2p

  Was this answer useful?  Yes

Sanjeev

  • Apr 3rd, 2015
 

sed 2 !d filename

  Was this answer useful?  Yes

Ataul

  • May 20th, 2015
 

Code
  1.  

  2. head -2 filename | tail -1

  3. Similarly to get the 2nd last line, the order will be reversed that is

  4. tail -2 filename | head -1



  Was this answer useful?  Yes

deepak

  • May 27th, 2015
 

sed -n 2p filename

  Was this answer useful?  Yes

Solomon

  • Jan 21st, 2017
 

sed -n 2p

  Was this answer useful?  Yes

shubham garg

  • Jan 24th, 2017
 

head -2 filename| tail -1

  Was this answer useful?  Yes

Soumya

  • Feb 6th, 2017
 

awk {print $2;} filename

  Was this answer useful?  Yes

Vikash Kumar

  • Feb 14th, 2017
 

sed -n 2p FileName

  Was this answer useful?  Yes

Tarun Thakur

  • Mar 28th, 2017
 

sed -n 2p filename

  Was this answer useful?  Yes

Nasirjamal MohdSiraj

  • May 25th, 2017
 

head -2 test | tail -1

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Answer Question

Click here to Login / Register your free account


 
Send   Reset

 

Related Answered Questions

 

Related Open Questions