#/bin/bash num=0 for loop in a b c d e f g h i j k do old[$num]=0 num=$(($num + 1)) done row=0 while true; do grep "$1 " /proc/diskstats | awk '{print $4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14}'; sleep 1; done | while read a b c d e f g h i j k do if [ $(($row % 30)) == 0 ]; then #echo -e "row\treads\trmerge\trsect\trms\t\twrites\twmerge\twsect\twms\t\tio\tms\tms2" echo -e "row\treads\trmerge\trsect\trms\twrites\twmerge\twsect\twms\tio\tms\tms2" fi row=$(($row + 1)) num=0 for loop in a b c d e f g h i j k do if [ ${old[$num]} == 0 ]; then old[$num]=${!loop} diff[$num]=0 else diff[$num]=$((${!loop} - ${old[$num]})) old[$num]=${!loop} fi num=$(($num + 1)) done echo -e "$row\t${diff[0]}\t${diff[1]}\t${diff[2]}\t${diff[3]}\t${diff[4]}\t${diff[5]}\t${diff[6]}\t${diff[7]}\t$i\t${diff[9]}\t${diff[10]}" done