先看一个例子
[root@puppet opt]# cat test.txt
a
b
c
d
e
f
g
[root@puppet opt]# awk 'NR%2==1{next}{print NR,$0}' test.txt
2 b
4 d
6 f
当记录行号除2等于1的时候就跳过该行,不会运行{print NR,$0},再重新读取下一行
next 的应用
[root@puppet opt]# cat age.txt
gao
20
li
23
zhao
25
liu
19
zhang
28
[root@puppet opt]# awk 'NR%2==1{T=$0;next}{print T,"\t"$0}' age.txt |sed '/^gao/i\NAME AGE'
NAME AGE
gao 20
li 23
zhao 25
liu 19
zhang 28