![]() |
|
|
|
|
|||||||
| 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 |
| find 2 line numbers, grab text in between | Da_Duck | Shell Programming and Scripting | 11 | 09-26-2006 09:51 AM |
| Print only certain lines from a text file | CamTu | Shell Programming and Scripting | 1 | 06-01-2005 08:47 AM |
| Search for text and print the next line | alijassim | Shell Programming and Scripting | 2 | 08-17-2004 03:08 AM |
| PERL:print 32 variables into a text file | perleo | Shell Programming and Scripting | 2 | 04-25-2003 03:23 AM |
| How to print a text file in landscape | yxiao | UNIX for Dummies Questions & Answers | 5 | 06-20-2002 03:21 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
how to print out line numbers of a text file?
i have this text file name test.txt which contain :
aaaaa bbb iiiiiiiiiiiii ccf ddaaa ddd and i need a script that can print out the line numbers using a while loop.. so when the script is run..it will have this: 1 2 3 any ideas? |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
I think the below sed command will help you
sed -n '=' datafile |
|
#3
|
|||
|
|||
|
thanks again for great help! solve part of my problem already..thanks...
|
|
#4
|
||||
|
||||
|
cat -n <filename>|awk '{print $1}'
should help |
|
#5
|
|||
|
|||
|
thanks very much!
|
|||
| Google The UNIX and Linux Forums |