0
以下awk
會生成current output
,其中所有行split
。然而,第一行似乎有一個空間,我似乎無法弄清楚爲什麼。不知道這是否是最好的方法,但它會產生接近正確的輸出。謝謝 :)。awk拆分和連接在輸出的一行中有額外空間
AWK
awk '{split($6,a,":"); print $1":",$2,$3,a[1],a[2],a[6],a[7]} {split($7,a,":"); print $1":"$2,$3,a[1],a[2],a[6],a[7]} {split($8,a,":"); print $1":"$2,$3,a[1],a[2],a[6],a[7]} {split($9,a,":"); print $1":"$2,$3,a[1],a[2],a[6],a[7]} {split($10,a,":"); print $1":"$2,$3,a[1],a[2],a[6],a[7]}' input > parse
輸入文件(分隔標籤)
chr1 13408 C 1 =:0:0.00:0.00:0.00:0:0:0.00:0.00:0.00:0:0.00:0.00:0.00 A:0:0.00:0.00:0.00:0:0:0.00:0.00:0.00:0:0.00:0.00:0.00 C:1:2.00:28.00:2.00:0:1:0.00:0.02:0.00:0:0.00:0.00:0.00 G:0:0.00:0.00:0.00:0:0:0.00:0.00:0.00:0:0.00:0.00:0.00 T:0:0.00:0.00:0.00:0:0:0.00:0.00:0.00:0:0.00:0.00:0.00 N:0:0.00:0.00:0.00:0:0:0.00:0.00:0.00:0:0.00:0.00:0.00
電流輸出(解析)
chr1: 13408 C A 0 0 0 (has a space between `chr1:` and `13408`)
chr1:13408 C C 1 0 1
chr1:13408 C G 0 0 0
chr1:13408 C T 0 0 0
chr1:13408 C N 0 0 0
所需的輸出
chr1:13408 C A 0 0 0 (has no space between `chr1:` and `13408`)
chr1:13408 C C 1 0 1
chr1:13408 C G 0 0 0
chr1:13408 C T 0 0 0
chr1:13408 C N 0 0 0
謝謝,我甚至沒有注意到......謝謝:)。 – Chris