Created
March 26, 2015 00:10
-
-
Save joshenders/2a7a7b00dc644a72b7a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# for each list of nodes in ISP metadata list | |
for country in metadata/by-isp/*; do | |
ccode="$(basename ${country})" | |
echo "${ccode}" | |
mkdir "by-isp/${ccode}" | |
# from node list for each country, create file with only tests from said country | |
pattern=$(awk '{ print $2 }' "${country}" \ | |
| tr '\n' '|' \ | |
| sed -e 's/\[/\\[/g' -e 's/\]/\\]/g' -e 's/|$//g') | |
egrep \"${pattern}\" by-month/february_noipv6.csv > "by-isp/${ccode}/february.csv" | |
# for each isp | |
while read line; do | |
node=$(awk '{ print $2 }' <<< "${line}" | sed -e 's/\]//g' -e 's/\[//g') | |
printf "[${node}] " | |
mkdir "by-isp/${ccode}/${node}" | |
egrep "\\[${node}\\]" "by-isp/${ccode}/february.csv" > "by-isp/${ccode}/${node}/february.csv" | |
done < "${country}" | |
printf "\n" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment