I want to replace to symbols ":" and "-" both to tab in the first column of a file:
The input is like:
chr1:100-200 1 2 3e-4
chr2:300-400 4 5 6e-4
And I want the output to be:
chr1 100 200 1 2 3e-4
chr2 300 400 4 5 6e-4
I know how to do replacement globally by "%s/:/^I/g" to replace ":" to a tab.
But because some of the entries have numbers in scientific notation such as 3e-4, I can not just use "%s/-/^I/g" to replace "-" to a tab.
Does anyone know how to specify replacement only to the first column?
Thanks.
You can use "Ctrl+V", active the "VISUAL BLOCK" mode, select the columns to be changed, press "c", make the change, and then "Esc", it will be applied to all selected columns.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With