get_carrier_names_finland.sh 1.3 KB

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. # Copyright (C) 2010 Mikko Lehto, mikko dot lehto at setera dot fi
  3. #
  4. # This file is part of sip-router, a free SIP server.
  5. #
  6. # sip-router is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version
  10. #
  11. # sip-router is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. # Small helper script for Finland:
  20. # Download the directory of finish carrier names and the respective IDs from
  21. # the regulation authorities and convert this into the format which the pdbt tool
  22. # understands.
  23. wget -O - "http://www2.ficora.fi/numerointi/nure_numbering.asp?nums=tot&amp;lang=en" | awk '/<tbody>/, /<\/tbody>/' | awk -F"</td" -v RS="</tr" '{ gsub(/.*>/,"",$1) gsub(/.*>/,"",$2); gsub(/&auml;/,"ä",$2); gsub(/&Aring;/,"Å",$2); gsub(/&ouml;/,"ö",$2); if ( $2 != "") { printf "D%.3d %s\n",$1,$2 } }'