Hello Vkhaw, and welcome to the Monastery!
For each line in the output file, you are running a series of substitutions. For example, for this line:
WL0,BL10,1708
you run:
command line = 'perl -pi.bak -e s/WL0,BL1/WL0,BL1,1708/g; CombineDie1D +ie2.txt'
and later
command line = 'perl -pi.bak -e s/WL0,BL10/WL0,BL10,1708/g; CombineDie +1Die2.txt'
and you expect the second substitution to be applied to the line. But the first substitution finds a match, and so replaces it:
WL0,BL10,1708 ******* s/WL0,BL1/WL0,BL1,1708/g
(The match is marked by asterisks.) This results in:
WL0,BL1,17080,1708
and the second match (the one you want) is never applied.
One way to fix this problem would be to re-order the matches so that the longer matches occur first. Another way would be to add a look-ahead assertion to match a comma:
s/WL0,BL1(?=,)/WL0,BL1,1708/g;
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: Unknown numbers show up
by Athanasius
in thread Unknow number show up
by Vkhaw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |