Skip to content

Instantly share code, notes, and snippets.

@yzaguirre
Last active August 29, 2015 13:58
Show Gist options
  • Save yzaguirre/9992844 to your computer and use it in GitHub Desktop.
Save yzaguirre/9992844 to your computer and use it in GitHub Desktop.
Con la herramienta xidel (licencia GPLv2) por cada campeón, con sus tres categorías, extrae los 10 nombres de campeones
#!/bin/bash
# http://videlibri.sourceforge.net/xidel.html#downloads
filename=champs.txt
while read -r nombre
do
name_nosuff=/home/david/tmp/campeones/$nombre
# ${name_nosuff}.html > ${name_nosuff}.1.html
# xidel aatrox.html -e 'css("#counterpicks-list.picks-list")'| sed 's/[ \t\n]*//' | sed '/^$/d' | tail -n +2 | head -n -1 | awk 'NR%7==1{print $0}' | less
# xidel aatrox.html -e 'css("#goodagainst-list.picks-list")'| sed 's/[ \t\n]*//' | sed '/^$/d' | tail -n +2 | head -n -1 | awk 'NR%7==1{print $0}' | less
# xidel aatrox.html -e 'css("#duopicks-list.picks-list")'| sed 's/[ \t\n]*//' | sed '/^$/d' | tail -n +2 | head -n -1 | awk 'NR%5==1{print $0}' | less
xidel ${name_nosuff}.html -e 'css("#counterpicks-list.picks-list")' | sed 's/[ \t\n]*//' | sed '/^$/d' | tail -n +2 | head -n -1 | awk 'NR%7==1{print $0}' > ${name_nosuff}.bad_against.txt
xidel ${name_nosuff}.html -e 'css("#goodagainst-list.picks-list")' | sed 's/[ \t\n]*//' | sed '/^$/d' | tail -n +2 | head -n -1 | awk 'NR%7==1{print $0}' > ${name_nosuff}.good_against.txt
xidel ${name_nosuff}.html -e 'css("#duopicks-list.picks-list")' | sed 's/[ \t\n]*//' | sed '/^$/d' | tail -n +2 | head -n -1 | awk 'NR%5==1{print $0}' > ${name_nosuff}.good_with.txt
rm ${name_nosuff}.html
done < "$filename"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment