George Carvalho
George Carvalho

Reputation: 97

Remove character in specific column after split using awk

Using awk on my data I have this result:

Command:

$ awk '{split($8,INFO,";"); print $1"\t"$2"\t"INFO[8]}' data.txt

Result:

chr1 1115252246 VMF=0.0426

chr1 115256495 VMF=0.0574

chr1 115256536 VMF=0.0465

chr1 115256579 VMF=0.0574

I'd like to remove the "VMF=" string from my third column using the same AWK code and have it:

chr1 115252246 0.0426

chr1 115256495 0.0574

chr1 115256536 0.0465

chr1 115256579 0.0574

Thank you!

Upvotes: 1

Views: 150

Answers (1)

Ed Morton
Ed Morton

Reputation: 203712

Add sub(/VMF=/,"",INFO[8]); between the split and the print.

Upvotes: 2

Related Questions