conv_software77-geoip_to_ac.awk 793 B

12345678910111213141516171819202122232425262728293031
  1. # convert geo-ip lists from software77 for Assaultcube servers
  2. #
  3. # expects to process IPV4-CSV lists from Webnet77 (please consider donations, if you use their lists)
  4. #
  5. # gawk -f conv_software77-geoip_to_ac.awk IpToCountry.csv > geoip.cfg
  6. #
  7. # download lists from http://software77.net/geo-ip/ (please don't download too often: once a month should be enough)
  8. #
  9. # thanks to Webnet77: http://webnet77.com
  10. #
  11. BEGIN {
  12. FS="," # expect csv
  13. getcc=0
  14. }
  15. function unquote(q) {
  16. gsub("\"", "", q)
  17. return q
  18. }
  19. substr($1,1,1)=="#" {
  20. next # comment
  21. }
  22. # expect lines like "38273024","38797311","ripencc","1275523200","KZ","KAZ","Kazakhstan"
  23. {
  24. print unquote($1) "-" unquote($2) " " unquote($5) " // " unquote($7)
  25. #print unquote($1) "-" unquote($2) " " unquote($5) # use this to drop the comments
  26. }