Here's a simple framework to start you out:
for FILE in /var/log/aventail/*; do
case "$(file $FILE)" in
*text* ) command1 $FILE | command2 ; command3 ;;
* ) echo "not a text file" ;;
This will loop through all the files in the directory and test the output of file for the string "text", and runs the command1-3 string if it finds it, or echos an error if it doesn't. You'll have to shove this into another loop if you want it to check multiple servers.
If you need general scripting help there are lots of good bash scripting tutorials available on the net. The Advanced Bash Scripting Guide is one of the best.