This is a test version of Biostars. For the public version, visit https://www.biostars.org.
column modifications related to SNP

This is my dataset: chr1_KI270706v1_random,153401,rs867658023,chr1_KI270706v1_random_153401 chr1_KI270706v1_random,154751,rs1030747857,chr1_KI270706v1_random_154751 chr1_KI270706v1_random,156703,rs900345029,chr1_KI270706v1_random_156703 chr1_KI270706v1_random,156856,rs576837150,chr1_KI270706v1_random_156856 I actually want it to be like:

chr1,153401,rs1867658023,chr1_153401

Basically I want to remove the extra value like KI_random from column 1 and column 4. I tried this command but I am not getting the desired output:

awk 'NR >1 {split($1, array, ""); print array[1] "" array[2]; split($2, array, ""); print array[1] "_" array[2]}' outfile > rsid.csv
modify snp vcf

1 answer

sed 's/_KI270706v1_random//g'

Log in to answer this question.