I want to use column utility to format output of iostat in aligned columns.
I want to run something like:
vmstat 1 10 | column -t
But the output appers only after 10 sec (vmstat completes its work) and not each second.
Any ideas?
try this:
vmstat -w 1 5
this works fine in vm, but when in physic machine which has large memory the columu of cpu maybe not looks as better as in vm.
The reason this happens is that column waits to gather as much input as possible on which to base its column guesses. It has no way of knowing that the data pattern repeats every second.
You can approximate what you want to do by running this:
for i in 0 1 2 3 4 5 6 7 8 9; do iostat | column -t; sleep 1; done
EDIT
Thanks to a couple of suggestions from Dennis:
for i in {0..9} ; do iostat 1 1 | column -t; sleep 1; done
The only difference from the original is that the first header line is repeated every second. Some footwork with sed
or grep
could take care of that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With