You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
229 B

#!/bin/bash
if [ $# -gt 0 ]; then
pat=$1
else
pat="gather"
fi
echo PATTERN=$pat
for f in *.txt; do
echo -n "$f "
grep "$pat" "$f" | \
awk -F: '{ total += $2; count++ } END { print total / count }'
done