Vmstat and column

I want to use a column utility to format iostat output in aligned columns.

I want to run something like:

vmstat 1 10 | column -t

But the output is displayed only after 10 seconds (vmstat completes its work), and not every second.

Any ideas?

+5
source share
3 answers

The reason for this is that the column expects to collect as much data as possible, on the basis of which its assumptions about the columns will be based. He does not know that the sample data is repeated every second.

You can get closer to what you want to do by doing this:

for i in 0 1 2 3 4 5 6 7 8 9; do iostat | column -t; sleep 1; done

EDIT

Thanks to two suggestions from Dennis:

for i in {0..9} ; do iostat 1 1 | column -t; sleep 1; done

, . sed grep .

+3

, , :

vmstat 1 10 | while read line
do
    echo "$line" | column -t
done
0

vmstat 1 10 >> /tmp/vmout.txt; tail -f /tmp/vmout.txt
-1
source

All Articles