View Single Post
Old Apr 14th, 2005, 2:40 PM   #2
sirclif
Newbie
 
Join Date: Oct 2004
Posts: 7
Rep Power: 0 sirclif is on a distinguished road
how do you want to change the numbers? you to through each line and seperate the "row#" from the actual number pretty easy with gawk by setting the field seperator to ": "

gawk -F ": " -v OFS=": " '{print $1,$2}' textfile.txt

this tells gawk that the field seperator for each record (each line) is a colon and a space. the -F option sets the input field seperator. -v tells gawk that a variable is going to be set, in this case OFS (output feild seperator).

this line will just print out the textfile.txt. if you wanted to change the number to the line number you would use

gawk -F ": " -v OFS=": " '{print $1,NR}' textfile.txt

otherwise you'll have to do some decision making on how to change the second field, and insert it into the $2 slot.

hope this helps a little
sirclif is offline   Reply With Quote