I want to extract some fields from the output of the xentop
. This is like the top
command; provides a constant look at processor usage, memory usage ... in real time. If I run this command in batch mode, I will have its output, as you see in the file:
NAME STATE CPU(sec) CPU(%) MEM(k) MEM(%) MAXMEM(k) MAXMEM(%) VCPUS NETS NETTX(k) NETRX(k) VBDS VBD_OO VBD_RD VBD_WR VBD_RSECT VBD_WSECT SSID Domain-0 -----r 13700 33.0 7127040 85.9 no limit n/a 8 0 0 0 0 0 0 0 0 0 0 fed18 -----r 738 190.6 1052640 12.7 1052672 12.7 3 1 259919 8265 1 0 82432 22750 2740966 1071672 0
and running this
cat file| tr '\r' '\n' | sed 's/[0-9][;][0-9][0-9][aZ]/ /g' | col -bx | awk '{print $1,$4,$6}'
in this file gives me what i want
NAME CPU(%) MEM(%) Domain-0 33.0 85.9 fed18 190.6 12.7
but my script does not work on xentop output in real time. I even tried to just start xentop once, setting the iteration parameter to 1 ( xentop -i 1
), but that xentop -i 1
work! How can I pass the xentop output as "not" in real time to my script?
source share