LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-27-2004, 05:44 PM   #1
KneeLess
Member
 
Registered: May 2003
Distribution: Debian GNU/Linux 3.0 Sid, OpenBSD 3.5
Posts: 190

Rep: Reputation: 30
Quick Q: Command to print line number X?


I need a command to print line number X that is not like more or less, because I tried a 'more -1 +9' or something, and I can't print just that one line without all of more's things. Is there any simple way of doing this? I don't feel like writing an awk script or something just for this...

E.g.
cat README | linenum --line=5
Which would print line 5 of README.
 
Old 05-27-2004, 07:49 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
sed '5,5!d' <filename>

To display line five of file <filename>



Cheers,
Tink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
number of command line arguments to shell u4u Linux - General 1 03-04-2005 06:09 PM
number of emails over command line kvtournh Linux - Software 1 01-11-2005 08:52 AM
Print line number X of a file (in shell) rheza Programming 4 01-04-2005 05:55 PM
print from command line, normally use cups itsjustme Linux - General 2 06-14-2004 11:14 AM
Print from command line cli_man Linux - Newbie 4 06-16-2002 09:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01: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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration