I am trying to extract the values of the %user,%nice etc from the output of the sar command.Command : sar -P ALL 1 1Output of this :Linux 2.6.32-358.el6.x86_64 (ftizsldapp009.ftiz.cummins.com)    09/28/2015      _x86_64_        (4 CPU)02:49:40 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle02:49:41 PM     all      3.01      0.00      2.51      0.00      0.00     94.4902:49:41 PM       0      1.98      0.00      3.96      0.00      0.00     94.0602:49:41 PM       1      6.00      0.00      4.00      0.00      0.00     90.0002:49:41 PM       2      2.00      0.00      1.00      0.00      0.00     97.0002:49:41 PM       3      1.98      0.00      2.97      0.00      0.00     95.05Average:        CPU     %user     %nice   %system   %iowait    %steal     %idleAverage:        all      3.01      0.00      2.51      0.00      0.00     94.49Average:          0      1.98      0.00      3.96      0.00      0.00     94.06Average:          1      6.00      0.00      4.00      0.00      0.00     90.00Average:          2      2.00      0.00      1.00      0.00      0.00     97.00Average:          3      1.98      0.00      2.97      0.00      0.00     95.05I have written following string to get the values but this doesn't seen to work. My Command :sar -P ALL 1 1 | awk  '{cpu=$3; pctUser=$4; pctNice=$5; pctSystem=$6; pctIowait=$7; pctIdle=$NF}' '{printf %-3s %9s %9s %9s %9s %9s\n, cpu, pctUser, pctNice, pctSystem, pctIowait, pctIdle}'Kindly advise, if you see any error in my command or if you can write/advise me on writing this.Thanks
Need help in writing awk to extract cpu utilization from sar command
awk;cpu usage;sar