#!/bin/bash for w in $(cat ROOT0); do let c1=$(fgrep -h -w $w stat.* | cut -f1 | xargs | tr ' ' '+' | bc) let c2=$(fgrep -h -w $w stat.* | cut -f2 | xargs | tr ' ' '+' | bc) let c3=$(fgrep -h -w $w stat.* | cut -f3 | xargs printf '%.0f\n' | xargs | tr ' ' '+' | bc) printf "%9.0f\t%9.0f\t%9.0f\t%s\n" "$c1" "$c2" "$c3" "$w"; done