I have many log files, each containing 1000+ lines. One part of file is below:
{@BLOCK|1%r1331|00
{@A-JUM|0|-9.352000E+06{@LIM2|+9.999999E+99|+1.000000E+04}}
}
{@BLOCK|1%x1001_swp|00
{@A-JUM|0|+3.362121E+00{@LIM2|+2.000000E+01|+0.000000E+00}}
}
{@BLOCK|1%x1101_swp|00
{@A-JUM|0|+3.282704E+00{@LIM2|+2.000000E+01|+0.000000E+00}}
}
{@BLOCK|1%x201_swp|00
{@A-JUM|0|+3.276452E+00{@LIM2|+2.000000E+01|+0.000000E+00}}
}
{@BLOCK|1%x202_swp|00
{@A-JUM|0|+3.216571E+00{@LIM2|+2.000000E+01|+0.000000E+00}}
}
I want to replace "+3.282704E+00" (8-th row) with another value. Is important to know, every tag like "{@BLOCK|1%x1101_swp|00" is unique, but line number for this tag may be different for different files. How can realize this in Lua? I tryed to use regex for both lines, between "@BLOCK" and "{@LIM2" but with no results. For:
{@BLOCK|1%x1101_swp|00
{@A-JUM|0|+3.282704E+00{@LIM2|+2.000000E+01|+0.000000E+00}}
I tryed:
if string.match(line,"{@BLOCK%|1%%1101_swp%|00..{@A-JUM%|0%|.............{@LIM2") then
string.gsub(line,"{@A-JUM%|0%|.............{@LIM2", "{@A-JUM%|0%|"..ff[#lines].."{@LIM2")
{@BLOCK|1%x1101_swp|00)? Do you have to match exactly+3.28270eE+00? If yes, this is easy. Please provide a bit more detail, then we can answer better :)