#!/bin/sh sed -r -e 's/^ *//' -e 's/ {2,}/|/g' < /proc/interrupts | awk -F'|' ' BEGIN { cpu_n = 0; } NR == 1 { for(i = 1; i <= NF; i++) if($i ~ CPU) cpu_n++; } NR > 1 { sum = 0; for(i = 2; i <= cpu_n + 1; i++) sum += $i; printf("%4s %12d %-20s ", $1, sum, $6); for(i = 1; i < 7; i++) $i = ""; print; }' | sort -nrk2