I have a string like.
ATATATATTATTATATTATATTATT
I want to substitute the characters to "C" by using these locations
3 7
10 18
15 20
desired Output:
ATCCCCCTTACCCCCCCCCCTTATT
any clue will be great help. :wall:
thanks in advance.
I have a string like.
ATATATATTATTATATTATATTATT
I want to substitute the characters to "C" by using these locations
3 7
10 18
15 20
desired Output:
ATCCCCCTTACCCCCCCCCCTTATT
any clue will be great help. :wall:
thanks in advance.
Assuming that your string is contained in a file:
perl -pe 'BEGIN{@x=(3,7,10,18,)};for ($i=0;$i<$#x;$i+=2){$_=((substr $_,0,$x[$i]-1)."C"x($x[$i+1]-$x[$i]+1).(substr $_,$x[$i+1]+1))}' file
Output is different from desired one.
ATCCCCCTTACCCCCCCCCCTTATT <= Desired
ATCCCCCTACCCCCCCCCTTATT <= Output
I think in for loop at every step it is keep on reducing a character...