Entering edit mode
                    4.4 years ago
        geno89
        
    
        ▴
    
    20
    My .bim file has format of SNP ID as  chr1_847228_C_T  and i want to change it to  chr1_847228 format. The reason to do is i want to apply --update name flag to update my SNP ids into rs ID and the reference file have the SNP id format as chr1_847228 .
Hi. Thanks it worked well to remove allele from chr1_847228_C_T but as my SNP ID column contains some other formats too like rs2880024 and exm888888 so it changed them to rs2880024_ and exm888888_. How can i remove this "_" from them. Thanks
Then you can do
awk '{n=split($2,a,"_"); if(n>=2){print $1,a[1]"_"a[2],$3,$4,$5,$6}}else{print $1,$2,$3,$4,$5,$6}' bim > new_bimYou can also do
print $0for theelsepart, though I am not sure if that will mess up the file separator (forgot the default of PLINK)