how to increment a number in a file

how to increment a number in a file

12
Basic UserBasic User
12

    Sep 22, 2010#1

    I have this code multiple times in a file

    Code: Select all

    TAB T=1     
    TAG POS=57 TYPE=A ATTR=TXT:info   
    'New page loaded      
    TAB T=2     
    TAG POS=1 TYPE=H2 ATTR=TXT:* EXTRACT=TXT  
    TAG POS=1 TYPE=P ATTR=TXT:* EXTRACT=TXT  
    TAG POS=1 TYPE=BODY ATTR=TXT:* EXTRACT=TXT  
    TAB CLOSE     
    SAVEAS TYPE=EXTRACT FOLDER=* FILE=*
    Now I want to increase TAG POS=57 to TAG POS=58, 59, 60 and so on. What can I use in this case?

    6,686585
    Grand MasterGrand Master
    6,686585

      Sep 22, 2010#2

      A small script is used best, for example below starting the count with 1.

      Code: Select all

      if( UltraEdit.document.length ) {
         UltraEdit.activeDocument.top();
         UltraEdit.ueReOn();
         UltraEdit.activeDocument.findReplace.mode=0;
         UltraEdit.activeDocument.findReplace.matchCase=true;
         UltraEdit.activeDocument.findReplace.matchWord=false;
         UltraEdit.activeDocument.findReplace.regExp=true;
         UltraEdit.activeDocument.findReplace.searchAscii=false;
         UltraEdit.activeDocument.findReplace.searchDown=true;
         UltraEdit.activeDocument.findReplace.searchInColumn=false;
         UltraEdit.activeDocument.findReplace.preserveCase=false;
         UltraEdit.activeDocument.findReplace.replaceAll=false;
         UltraEdit.activeDocument.findReplace.replaceInAllOpen=false;
         var nTagPos = 1;
         while( UltraEdit.activeDocument.findReplace.replace("TAG POS=[0-9]+", "TAG POS="+nTagPos.toString())) nTagPos++;
         UltraEdit.activeDocument.top();
      }
      Best regards from an UC/UE/UES for Windows user from Austria