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?
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?
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.