On Fri, Feb 12, 2010 at 3:32 AM, elavazhagan perl < elavazhagan.p...@gmail.com> wrote:
> *ORIGINAL CONTENT:* > <Field ID="*20000*"> > <AttrSet ID="Core"> > <integer ID="ZoneId" Value="999" /> > <string ID="Name" Value="42_*L1*_Valid_Line_Indicator_*20000*" /> > <boolean ID="LinkedCoord" Value="false" /> > <integer ID="Type" Value="3" /> > <integer ID="x" Value="0" /> > <integer ID="y" Value="0" /> > <integer ID="w" Value="10" /> > <integer ID="h" Value="10" /> > </AttrSet> > </Field> > > *DESIRED OUTPUT:* > > <Field ID="*20980*"> > <AttrSet ID="Core"> > <integer ID="ZoneId" Value="999" /> > <string ID="Name" Value="42_*L1000*_Valid_Line_Indicator_*20980*" /> > <boolean ID="LinkedCoord" Value="false" /> > <integer ID="Type" Value="3" /> > <integer ID="x" Value="0" /> > <integer ID="y" Value="0" /> > <integer ID="w" Value="10" /> > <integer ID="h" Value="10" /> > </AttrSet> > </Field> > In summary, you want to... 1. Read an entire file into one string. 2. Using a regular expression, get the current value of "Field ID". 3. Loop from 2 to 1000... 1. Increment "Field ID" by 20. 2. Substitute the new "Field ID" for the old one, using regular expressions. 3. Substitute the counter (Lxxxx) in the <string ID="Name"> field. 4. Write the entire block out to a new file. Is that accurate? -- Robert Wohlfarth