help #2 (thnx!)
Posted: Fri Dec 12, 2014 11:21 am
Hi all,
forgive to me but I need a help with Reg Ex.
in the following matrix of data (space delimited), I need:
1) to transform any numeric value ".xyz" in "0.xyz" (preserving the 1.000)
than, about column headers (usually the first lane of the matrix) and the same in the first column of the matrix I need:
2) to transform any "1:abcdefghijklm" in "0001:abcdefghijklm"; "2:abcdefghijklm" in "0002:abcdefghijklm"; . . . "9:abcdefghijklm" in "0009:abcdefghijklm"
and so on for all the "one digit numbers"
3) to transform any "10:abcdefghijklm" in "0010:abcdefghijklm"; "11:abcdefghijklm" in "0011:abcdefghijklm"; . . . "99:abcdefghijklm" in "0099:abcdefghijklm"
and so on for all the "two digit numbers"
4) to transform any "100:abcdefghijklm" in "0100:abcdefghijklm"; "101:abcdefghijklm" in "0101:abcdefghijklm"; . . . "999:abcdefghijklm" in "0999:abcdefghijklm"
and so on for all the "three digit numbers"
many thanks in advance
all the best
a.b.
matrix:
1:ADI0001aMA2d2 2:ADI0001aMA2n1 3:ADI0004aMA2n1 <snip>10:ADI0023cMA2n2 11:ADI0023cMA2p3 12:ADI0026aMA2n3 <snip>100:BRE0724aMA2h2:
1:ADI0001aMA2d2 1.000 .909 .750 .824 .844 .658 .730 .730 .703 .352 .438 .824 .829 .771 .794 .743 .848
2:ADI0001aMA2n1 .909 1.000 .778 .800 .818 .684 .711 .711 .684 .370 .429 .800 .806 .750 .824 .722 .824
<snip>
10:ADI0023cMA2n2 .352 .370 .345 .304 .321 .370 .339 .364 .370 1.000 .633 .352 .364 .352 .358 .385
11:ADI0023cMA2p3 .438 .429 .429 .408 .467 .458 .449 .511 .522 .633 1.000 .500 .479 .468 .478 .478
12:ADI0026aMA2n3 .824 .800 .750 .824 .844 .703 .730 .829 .800 .352 .500 1.000 .829 .824 .848 .848
<snip>
100:BRE0724aMA2h2 .540 .529 .560 .510 .510 .560 .519 .519 .500 .492 .474 .510 .549 .540 .551 .551
101:BRE0726bMA2n3 .667 .690 .690 .667 .675 .732 .600 .636 .614 .473 .540 .750 .756 .667 .769 .725
<snip>
1001:VMA0011dMA2s3 .583 .604 .604 .583 .553 .604 .592 .625 .604 .526 .566 .652 .660 .583 .596 .596
1002:VMA0013dMA2s3 .610 .595 .595 .692 .615 .675 .700 .700 .675 .453 .521 .650 .700 .610 .625 .585
forgive to me but I need a help with Reg Ex.
in the following matrix of data (space delimited), I need:
1) to transform any numeric value ".xyz" in "0.xyz" (preserving the 1.000)
than, about column headers (usually the first lane of the matrix) and the same in the first column of the matrix I need:
2) to transform any "1:abcdefghijklm" in "0001:abcdefghijklm"; "2:abcdefghijklm" in "0002:abcdefghijklm"; . . . "9:abcdefghijklm" in "0009:abcdefghijklm"
and so on for all the "one digit numbers"
3) to transform any "10:abcdefghijklm" in "0010:abcdefghijklm"; "11:abcdefghijklm" in "0011:abcdefghijklm"; . . . "99:abcdefghijklm" in "0099:abcdefghijklm"
and so on for all the "two digit numbers"
4) to transform any "100:abcdefghijklm" in "0100:abcdefghijklm"; "101:abcdefghijklm" in "0101:abcdefghijklm"; . . . "999:abcdefghijklm" in "0999:abcdefghijklm"
and so on for all the "three digit numbers"
many thanks in advance
all the best
a.b.
matrix:
1:ADI0001aMA2d2 2:ADI0001aMA2n1 3:ADI0004aMA2n1 <snip>10:ADI0023cMA2n2 11:ADI0023cMA2p3 12:ADI0026aMA2n3 <snip>100:BRE0724aMA2h2:
1:ADI0001aMA2d2 1.000 .909 .750 .824 .844 .658 .730 .730 .703 .352 .438 .824 .829 .771 .794 .743 .848
2:ADI0001aMA2n1 .909 1.000 .778 .800 .818 .684 .711 .711 .684 .370 .429 .800 .806 .750 .824 .722 .824
<snip>
10:ADI0023cMA2n2 .352 .370 .345 .304 .321 .370 .339 .364 .370 1.000 .633 .352 .364 .352 .358 .385
11:ADI0023cMA2p3 .438 .429 .429 .408 .467 .458 .449 .511 .522 .633 1.000 .500 .479 .468 .478 .478
12:ADI0026aMA2n3 .824 .800 .750 .824 .844 .703 .730 .829 .800 .352 .500 1.000 .829 .824 .848 .848
<snip>
100:BRE0724aMA2h2 .540 .529 .560 .510 .510 .560 .519 .519 .500 .492 .474 .510 .549 .540 .551 .551
101:BRE0726bMA2n3 .667 .690 .690 .667 .675 .732 .600 .636 .614 .473 .540 .750 .756 .667 .769 .725
<snip>
1001:VMA0011dMA2s3 .583 .604 .604 .583 .553 .604 .592 .625 .604 .526 .566 .652 .660 .583 .596 .596
1002:VMA0013dMA2s3 .610 .595 .595 .692 .615 .675 .700 .700 .675 .453 .521 .650 .700 .610 .625 .585