can I enumerate the lines using foreach command after readfile

Comments

1 comment

  • Avatar
    juanjo

    You could use the below code:

     <readFile>
           <name>text</name>
           <path>${file}</path>
     </readFile>
     <while>
        <actionList>
          <setInstallerVariableFromRegEx name="line" pattern="^([^\n]*)(\n|$).*" substitution="\1" text="${text}"/>
          <setInstallerVariableFromRegEx name="text" pattern="^[^\n]*(\n|$)(.*)" substitution="\2" text="${text}"/>
          <!-- Operate over the captured line -->
                <setInstallerVariableFromRegEx name="name" pattern="\s*([^=]+)=([^\n]*)" text="${line}" substitution="\1"/>
                <setInstallerVariableFromRegEx name="value" pattern="\s*([^=]+)=([^\n]*)" text="${line}" substitution="\2"/>
                <setInstallerVariable name="${name}" value="${value}"/>
                <globalVariables names="${name}"/>
         </actionList>
         <conditionRuleList>
            <regExMatch text="${text}" logic="matches" pattern="[^\n]+.*(\n|$)"/>
         </conditionRuleList>
     </while>
    

Please sign in to leave a comment.