如果我在下面有一個輸入文件,Linux中是否有任何命令/方式將它轉換爲我所需的文件,如下所示?在linux中合並行
輸入文件:
Column_1 Column_2
scaffold_A SNP_marker1
scaffold_A SNP_marker2
scaffold_A SNP_marker3
scaffold_A SNP_marker4
scaffold_B SNP_marker5
scaffold_B SNP_marker6
scaffold_B SNP_marker7
scaffold_C SNP_marker8
scaffold_A SNP_marker9
scaffold_A SNP_marker10
所需的輸出文件:
Column_1 Column_2
scaffold_A SNP_marker1;SNP_marker2;SNP_marker3;SNP_marker4
scaffold_B SNP_marker5;SNP_marker6;SNP_marker7
scaffold_C SNP_marker8
scaffold_A SNP_marker9;SNP_marker10
我想用grep,uniq的等,但還是沒能弄清楚如何得到這個工作。
perl是一個選項嗎? – urzeit
等待,在您的輸出scaffold_A出現兩次。什麼決定是否給予標記應該去第一個或第二個入口? –
@SF。看來OP希望按Column_1分組輸出 - 但僅限於現有組。 –