1、awk實現
root@PC1:/home/test2# ls test.txt root@PC1:/home/test2# cat test.txt ## 測試數據 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 root@PC1:/home/test2# awk '{temp = $1; $1 = $2; $2 = temp; print $0}' test.txt ## 實現第一列數據和第二列數據的互換 02 01 03 04 06 05 07 08 10 09 11 12 14 13 15 16 18 17 19 20