![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Adding a columnfrom a specifit line number to a specific line number | Ezy | Shell Programming and Scripting | 2 | 05-12-2008 05:29 AM |
| Extract a line from a file using the line number | zambo | Shell Programming and Scripting | 1 | 05-01-2008 10:39 AM |
| extract a line from a file using the line number | grandtheftander | Shell Programming and Scripting | 6 | 02-06-2008 03:12 AM |
| Appending the line number and a seperator to each line of a file ? | pjcwhite | Shell Programming and Scripting | 4 | 03-20-2007 10:29 PM |
| Get line form file by line number | corny | Shell Programming and Scripting | 3 | 08-25-2006 09:18 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Getting a line of a file by number
I was wondering if their is a command that will output a line of a file by number. I mean i know how number a file but what i'm looking for is to pull a line out of a file by refering to its line number. Is their anyway of doing this. Thanks in advance
|
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
sed1liners
Code:
# print line number 52 sed -n '52p' # method 1 sed '52!d' # method 2 sed '52q;d' # method 3, efficient on large files |
|
#3
|
|||
|
|||
|
Thanks that helpled me out
|
|
#4
|
|||
|
|||
|
Quote:
Hi, I have a similar problem.I want to display few lines say from line 10 to 15th in a 60 line file.The above command is not taking more than one address so suitable to display one line only.Can you help me. Thanks, |
|
#5
|
|||
|
|||
|
sed -n '10,15p' filename
or perl -ne 'print if 10..15' filename |
|
#6
|
||||
|
||||
|
Quote:
|
|
#7
|
|||
|
|||
|
Thanks friends.
|
|||
| Google The UNIX and Linux Forums |