I want to delete text after the first colon : (inclusive), or replace it with nothing.
For example, 1:5:30 should be changed into 1. I prefer an awk script to perform this job. But I do not know how to do that. Could you please give me any directions? Thanks in advance.
My data are tab-delimited, and the file looks like there are points in some cells.
1 313 . T C 30.11 1:5:30 . . .
1 316 . A T 30.80 1:5:30 . 0:8:28 .
1 317 . T A 31.40 1:5:36 . 0:8:28 .
I tried the following, but I failed with all of them:
sed 's/:*:*//g' mydatafile
sed 's/:[0-9]:[0-9]//g' mydatafile
Bit unclear what the desired output should be, but this is my interpretation, using
sed:Using awk:
Using Cut:
Using bash:
Alternative interpretation using awk:
3rd and hopefully last update
3rd interpretation using awk: