NF当前处理数的个数
[[email protected]_207_144_centos bin]# echo a b c | awk ‘{print NF}‘
3
$NF当前处理数中的最后一位数
[[email protected]_207_144_centos bin]# echo a b c | awk ‘{print $NF}‘
c
FR当前处理行中的所指定的行数
[[email protected]_207_144_centos bin]# curl "http://127.0.0.1/nginxstatus" 2> /dev/null | awk NR==2 | awk ‘{print $3}‘
handled
[[email protected]_207_144_centos bin]# curl "http://127.0.0.1/nginxstatus"
Active connections: 1
server accepts handled requests
148 148 148
Reading: 0 Writing: 1 Waiting: 0
FNR当前处理行的行数
[[email protected]_207_144_centos bin]# curl "http://127.0.0.1/nginxstatus" 2> /dev/null | awk ‘{print FNR}‘
1
2
3
4
[[email protected]_207_144_centos bin]# curl "http://127.0.0.1/nginxstatus" 2> /dev/null | awk NR==2 | awk ‘{print FNR}‘
1
时间: 2024-10-11 21:01:41