for i in $(seq 1 10) do name=$(head -n $i hp_top10.txt | tail -n 1) creditos=$(mysql estadisticas -Ne "select truncate(sum(creditos_asignados),0) from maquina, ibercivis.user where userid = user.id and user.name = '$name' and fecha >= 20090601 and fecha < 20090701") echo $i:$name:$creditos echo $creditos >> lista_hp.txt done echo "" echo "" for i in $(seq 1 10) do name=$(head -n $i ayto_top10.txt | tail -n 1) creditos=$(mysql estadisticas -Ne "select truncate(sum(creditos_asignados),0) from maquina, ibercivis.user where userid = user.id and user.name = '$name' and fecha >= 20090601 and fecha < 20090701") echo $i:$name:$creditos echo $creditos >> lista_ayto.txt done