Previous in Forum: Hard Drive Recovery?   Next in Forum: Pro/E Drawing Question
Close
Close
Close
Rate Comments: Nested
Anonymous Poster

Unix Command to View Single Line

10/08/2010 1:56 AM

Hi, i have a file having 1 lakh records, please tell me unix command to view a particular line only

ex (line no. 5000)

Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.
Guru

Join Date: Feb 2009
Location: Houston, USA
Posts: 946
Good Answers: 244
#1

Re: Unix Command to View Single Line

10/08/2010 1:43 PM

Try this:

cat file_name | head –n 5000 | tail –n 1

or

head –n 5000 file_name | tail –n 1

'head -n 5000' gets the first 5000 lines from the file and then pipes to 'tail -n 1' to get the last line of of the first 5000 lines. Evetually, it will show only the 5000th line.

- MS

__________________
"All my technical advices in this forum must be consulted with and approved by a local registered professional engineer before implementation" - Mohammed Samad (Linkedin Profile: http://www.linkedin.com/in/msamad)
Reply
Reply to Forum Thread

Previous in Forum: Hard Drive Recovery?   Next in Forum: Pro/E Drawing Question
You might be interested in: Line-shaft Spools, Power Line Network Components

Advertisement