LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 12-28-2005, 05:44 AM   #1
minil
Member
 
Registered: Dec 2004
Location: Bangalore, India
Distribution: Fedora 2
Posts: 74

Rep: Reputation: 15
command or shell script to print line range from file


Hi
i need a script or command to print range of line from a specified file

For eg.
$ [command] 10 20 file

This should display line numbers from 10 to 20 from the file.
Its urgent..
Thanks in advance.

regards
Minil
 
Old 12-28-2005, 05:47 AM   #2
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Rep: Reputation: 30
Code:
sed -n '10,20p' <filename>
 
Old 12-28-2005, 08:16 AM   #3
vetrimani
LQ Newbie
 
Registered: Dec 2005
Posts: 8

Rep: Reputation: 0
you can use awk 'NR>=10&&NR<=20' file
 
Old 12-28-2005, 09:05 AM   #4
minil
Member
 
Registered: Dec 2004
Location: Bangalore, India
Distribution: Fedora 2
Posts: 74

Original Poster
Rep: Reputation: 15
Its nice..

thank u ..for your reply..
 
  


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
bash shell script read file line by line. Darren[UoW] Programming 51 07-04-2013 09:16 PM
how to pass command-line parameter to shell script? Kropotkin Linux - Newbie 12 07-25-2011 10:24 AM
How to execute a command line in a shell script orgazmo Programming 5 05-09-2005 10:16 AM
Print line number X of a file (in shell) rheza Programming 4 01-04-2005 06:55 PM
Shell Script to read 500files from the command line saravanan1979 Programming 1 09-22-2004 10:44 AM


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