Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 12-31-2003, 11:35 AM   #1
Registered: Feb 2002
Posts: 586

Rep: Reputation: 30
cat: output specific number of lines

Can cat command output specific number of lines? Example, output lines from 1 to 10 .
Old 12-31-2003, 11:58 AM   #2
Senior Member
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
Try using head:
head -10 /path/to/file
Old 12-31-2003, 12:02 PM   #3
Registered: Feb 2002
Posts: 586

Original Poster
Rep: Reputation: 30
Originally posted by stickman
Try using head:
head -10 /path/to/file
Is it possible to output from position 10 to 30 ?
With two parameters ?
Old 12-31-2003, 01:15 PM   #4
Senior Member
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 50
head -30 /path/to/file | tail -20

print the last 20 of the first 30 lines ie 10-30


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
Reading the number of Lines in a File Programming 31 11-24-2005 01:36 AM
output number of blank lines tjgadu Linux - Newbie 7 06-09-2005 05:01 PM
Cat input output error zaicheke Slackware 15 12-26-2004 10:08 PM
output to a file - cat? grep? Godsmacker777 Linux - Newbie 6 12-08-2004 11:06 AM
replacing specific lines in a text document stellarmarine1 Linux - General 1 09-07-2004 03:34 PM

All times are GMT -5. The time now is 03:40 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration