linux 中判断一列数据是否按照指定步长递增
linux 中判断一列数据是否按照指定步长递增
001、
[root@pc1 test01]# ls a.txt b.txt [root@pc1 test01]# cat a.txt ## 测试数据, 正确递增 1 2 3 4 5 6 [root@pc1 test01]# cat b.txt ## 测试数据, 异常递增 1 2 4 5 6 [root@pc1 test01]# awk '{if(NR == 1) {tmp = $1} else {if($1 - tmp != 1) {print NR, "error"}; tmp=$1}}' a.txt [root@pc1 test01]# awk '{if(NR == 1) {tmp = $1} else {if($1 - tmp != 1) {print NR, "error"}; tmp=$1}}' b.txt 3 error

。

浙公网安备 33010602011771号