This will replace only the second match on each line:
sed 's/:/ /2'
Pergunta
I have a file containing several thousand lines, which look something like this:
dm 10:124614405:G_GTR I .9186 .9829 -0.037 0.964 0.219 0.0283 0.8665 0.0282 0.8665 358 440
dm 10:124685661:TCAAAR D .9698 .9838 0.239 1.270 0.377 0.4016 0.5263 0.4040 0.525 358 440
dm rs2280710 C G .9852 .9924 0.186 1.204 0.899 0.0427 0.8362 0.0418 0.838 165 92
I need to replace the second ":" with a space, throughout the whole document. Normally I would do this with something simple like:
sed 's/:/ /g'
But this will of course replace both colons. I'm not sure how to specify only the SECOND colon be replaced. Any suggestions?
Solução
This will replace only the second match on each line:
sed 's/:/ /2'