1、测试数据

root@PC1:/home/test/test/test2# cat nuc.ped
G G C C G G G G A G A A
G G G C G G G G G G A A
G G C C G G G G G G A A
G G C C G G G G G G A A
G G C C G G G G G G A A
G G C C G G G G G G A A
G G C C G G A G A A A A
G G C C G G A G A A A A

 

2、使用awk命令

root@PC1:/home/test/test/test2# awk '{for(i = 1; i <= NF; i++) if(i % 2 == 0) {printf("%s\t", $i)} else {printf("%s ", $i)} {printf("\n")}}' nuc.ped
G G     C C     G G     G G     A G     A A
G G     G C     G G     G G     G G     A A
G G     C C     G G     G G     G G     A A
G G     C C     G G     G G     G G     A A
G G     C C     G G     G G     G G     A A
G G     C C     G G     G G     G G     A A
G G     C C     G G     A G     A A     A A
G G     C C     G G     A G     A A     A A