Subj : Re: Program For Simple Text File Editing To : comp.programming From : John W. Krahn Date : Mon Oct 10 2005 09:05 am mwmiller314@gmail.com wrote: > I'm interested in avoiding a common text editing task. It takes the > form of editing a simple text file that I commonly open and change > myself. The file typically looks something like the following: > > "/join arkansas:2" > "/join missouri:3" > "/join kentucky:4" > "/join tennessee:2" > > --- > I desire to edit the line not indented each time. In this case it is: > > "/join missouri:3" > > The change I desire to be made by a program is to increment the number > appearing after the ':' but before the quotation mark. In this case > there is no number. I want the file to read: > > "/join arkansas:2" > "/join missouri:4" > "/join kentucky:4" > "/join tennessee:2" perl -i.bak -pe's!^("/join \w+:)(\d+)(?=")!$1 . ($2 + 1)!e' yourfile John -- use Perl; program fulfillment .