awk + ​​无法从 iostat 中剪切字段

awk + can't cut the field from iostat

当我执行以下操作时,我们得到输出

iostat -x 1|grep sdb
sdb               0.00    13.65    4.17   11.65   113.72   991.55   139.74     0.24   15.39    3.27   19.73   0.46   0.72
sdb               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00

现在我想剪切第二个字段,但是现在我们没有输出

[root@linux1 ~]#   iostat -x 1|grep sdb | awk '{print }'

另外,管道没有输出,

iostat -x 1|grep sdb | more

为什么?

能否请您尝试关注。

iostat -x 1 | grep --line-buffered "sdb" | awk '{print }'

OR 仅 awk:

iostat -x 1 | awk '/sdb/{print ;fflush();}'

iostat -x 1 | awk '=="sdb"{print ;fflush();}'

来自 man awk 页面:

fflush([file]) Flush any buffers associated with the open output file or pipe file. If file is missing or if it is the null string, then flush all open output files and pipes.