1、
[root@PC1 test2]# ls a.txt [root@PC1 test2]# cat a.txt 8 4 2 2 8 3 1 3 4 3 4 6 [root@PC1 test2]# awk 'BEGIN{a = 0} {print $1 - a; a = $1}' a.txt ## 输出第一列连续数值的差 8 -6 -1 2
1、
[root@PC1 test2]# ls a.txt [root@PC1 test2]# cat a.txt 8 4 2 2 8 3 1 3 4 3 4 6 [root@PC1 test2]# awk 'BEGIN{a = 0} {print $1 - a; a = $1}' a.txt ## 输出第一列连续数值的差 8 -6 -1 2