I have a file (1kG_MDS5.bim) like this:
1 rs58108140 0 10583 A G
1 1:11508[b37]A,G 0 11508 A G
1 1:15820[b37]G,T 0 15820 T G
1 1:16257[b37]C,G 0 16257 C G
1 1:16378[b37]C,T 0 16378 T C
I would like to remove all occurrences of [b37] in the 2nd column and also replace comma with column so that the FINAL result looks like this:
1 rs58108140 0 10583 A G
1 1:11508:A:G 0 11508 A G
1 1:15820:G:T 0 15820 T G
1 1:16257:C:G 0 16257 C G
1 1:16378:C:T 0 16378 T C
I tried to partially solve this (by just removing [b37]) by running:
sed -i -E 's/([b37])/:/g' 1kG_MDS5.bim
but I got this:
1 rs58108140 0 1058: A G
1 1:11508[:::]A,G 0 11508 A G
1 1:15820[:::]G,T 0 15820 T G
1 1:1625:[:::]C,G 0 1625: C G
Can you please advise me on how to get the final results where the lines would look like shown above. It doesn't need to be sed solution (awk would be great) Also this file contains about 6 million lines.