输入:
boundary = 0
输出:
library(ggplot2)
df <- data.frame(x = rnorm(100)*10)
ggplot(df, aes(x)) +
geom_histogram(binwidth = 5, boundary = 0, color = "black", fill = "red")
期望的输出:
#iostat -DlR 1 2
我想要所需的输出。
root@myserver #iostat -DlR 1 2
System configuration: lcpu=20 drives=2 paths=16 vdisks=0
Disks: xfers read write queue
--------------- -------------------------------- ------------------------------------ ------------------------------------ --------------------------------------
%tm bps tps bread bwrtn rps avg min max time fail wps avg min max time fail avg min max avg avg serv
act serv serv serv outs serv serv serv outs time time time wqsz sqsz qfull
hdisk1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0.0 0.0 0.0 0.0 0 0 0.0 0.0 0.0 0.0 0.0 0.0
hdisk0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0.0 0.0 0.0 0.0 0 0 0.0 0.0 0.0 0.0 0.0 0.0
Disks: xfers read write queue
--------------- -------------------------------- ------------------------------------ ------------------------------------ --------------------------------------
%tm bps tps bread bwrtn rps avg min max time fail wps avg min max time fail avg min max avg avg serv
act serv serv serv outs serv serv serv outs time time time wqsz sqsz qfull
hdisk1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0.0 0.0 0.0 0.0 0 0 0.0 0.0 0.0 0.0 0.0 0.0
hdisk0 0.0 77.8K 19.0 0.0 77.8K 0.0 0.0 0.0 0.0 0 0 19.0 0.3 0.2 0.5 0 0 0.0 0.0 0.0 0.0 0.0 0.0
当我运行上面的命令时,我得到的就是这个(这不是我想要的输出:
Device bps tps bread bwrtn
hdisk1 0.0 0.0 0.0 0.0
hdisk0 0.0 0.0 0.0 0.0
hdisk1 0.0 0.0 0.0 0.0
hdisk0 77.8k 19.0 0.0 77.8K
答案 0 :(得分:0)
$ awk '
!NF { f=0 }
$1=="%tm" { if (!cnt++) print "Device", $2, $3, $4, $5; f=1 }
f && /^[^[:space:]]/ { print $1, $3, $4, $5, $6 }
' file | column -t
Device bps tps bread bwrtn
hdisk1 0.0 0.0 0.0 0.0
hdisk0 0.0 0.0 0.0 0.0
hdisk1 0.0 0.0 0.0 0.0
hdisk0 77.8K 19.0 0.0 77.8K