Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
w3c_autovalidar
extract () {
if [ -f $1 ];
then
case $1 in
*.tar) tar -xvf $1 ;;
*.tgz) tar -xvzf $1 ;;
*.tar.gz) tar -xvzf $1 ;;
*.tbz2) tar -xvjf $1 ;;
*.tar.bz2) tar -xvjf $1 ;;
*.gz) gunzip $1 ;;
*.bz2) bunzip2 $1 ;;
*.zip) unzip -o -q $1 ;;
*.rar) unrar x -y -inul $1 ;;
*) echo " '$1' file type unknown" ;;
esac
fi
}
echo "Calculando multiplicador"
rm -f resultados_totales.txt
for a in $(ls -d 15*/)
do
cd $a
for f in $(ls *.*)
do
extract $f
done
t=0;
cd ..
for i in $(find $a -iname "*.css" -or -iname "*.html")
do
t=$[$t+$(w3c-validator.py $i)]
done
echo $a" "$t
echo $a" "$t>>resultados_totales.txt
done
promedio=0;
for i in $(cat resultados_totales.txt| awk -F' ' '{print $2}')
do
promedio=$[$promedio+$i]
done
promedio=$[$promedio/$(cat resultados_totales.txt|wc -l)]
echo $promedio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.