LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-12-2004, 06:37 PM   #1
aznluvsmc
Member
 
Registered: Aug 2004
Location: Newmarket, Ontario
Distribution: OpenSuse 10.2
Posts: 184

Rep: Reputation: 30
Command to output file content line by line


Hi,

Is there a command that will output a requested line number of a file?
 
Old 09-12-2004, 07:01 PM   #2
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
I don't know of a specific command (there probably is one somewhere), but you can use:
Code:
head -n 100 filename | tail -n 1
to print out line 100.
 
Old 09-12-2004, 07:45 PM   #3
arvind_sv
Member
 
Registered: Oct 2002
Location: Bangalore
Distribution: Gentoo Linux
Posts: 96

Rep: Reputation: 16
Hi,

Try this:

sed -n 100p filename

Arvind
 
  


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
C++ text file line by line/each line to string/array Dimitris Programming 15 03-11-2008 08:22 AM
Command line to get output on a file satimis Programming 4 06-24-2005 06:04 AM
Redirecting output to a command-line argument of another command madiyaan Linux - Newbie 1 02-19-2005 04:35 PM
how to enumerate first line of text file to standard output? zero79 Linux - General 1 07-07-2004 06:37 PM
linux scripting help needed read from file line by line exc commands each line read atokad Programming 4 12-26-2003 10:24 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:54 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