This will print filenames and level numbers that exceed 50
egrep -r -e 'Plvl[ ]+[0-9]+' . | awk "{if(\$2 > 50) {printf(\"%s %s\\n\", \$1, \$2);}}" | sed 's/:Level//'
If you wanted to remove those files, but be careful!
egrep -r -e 'Plvl[ ]+[0-9]+' . | awk "{if(\$2 > 50) {printf(\"%s\\n\", \$1);}}" | sed 's/:Level//' | xargs rm
#!/bin/bash
echo "Checking player files…"
count=0
amount=0
for f in *
do
if [ -f $f ]
then
output=$f
((count++))
matched=$(egrep -e '^Plvl[ ]+[0-9]+' "${f}" | awk "{if(\$2 <= 10000) {printf(\"%s\\n\", \$f);}}")
if [[ $matched ]]
then
((amount++))
fi
fi
done
echo "Found $amount matched files out of $count files"
My problem is it just spits out this: size: 'a.out': No such file