LinuxQuestions.org
Help answer threads with 0 replies.
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
 
LinkBack Search this Thread
Old 12-28-2005, 04: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, 04: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, 07: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, 08: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
Trackbacks are Off
Pingbacks are On
Refbacks are 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 08:16 PM
how to pass command-line parameter to shell script? Kropotkin Linux - Newbie 12 07-25-2011 09:24 AM
How to execute a command line in a shell script orgazmo Programming 5 05-09-2005 09:16 AM
Print line number X of a file (in shell) rheza Programming 4 01-04-2005 05:55 PM
Shell Script to read 500files from the command line saravanan1979 Programming 1 09-22-2004 09:44 AM


All times are GMT -5. The time now is 09:35 AM.

Main Menu
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