linux - Extracting %CPU usage from VMSTAT in a file -


  1. i tried "vmstat > file.txt" -->works fine , output comes file.

  2. when tried extract column cpu ie "vmstat 5 | awk '{print $13}' > file.txt" -->didn't work , no output being written.

    how can extract column cpu usage file ?

i had couple of problems. first vmstat columns can garbled if not use -w switch. secondly used cut data, buffering, had include stdbuf in command disable buffering

vmstat 5 -w | stdbuf -o0 cut -c84- > file.txt 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -