Page 1 of 1

A script to dump country-info in spreadsheet-friendly format

Posted: Tue Mar 07, 2023 10:50 pm
by 611
Just in case you're curous of what's inside country-info DB:
:global formatFreqRange do= {
  :if ( [:find $range "turbo"] < 0 && [:len $range] > 0) do={ 
    :local startfreq ([:pick $range 0 [:find $range "-"]]);
    :local endfreq ([:pick $range ([:find $range "-"]+1) [:find $range "/"]]);
    :local modes ([:pick $range ([:find $range "/"]+1) [:find $range "("]]);
    :local power ([:pick $range ([:find $range "("]+1) [:find $range "dBm)"]]);
    :local range1 (" " . $range);
    :local flagdfs ([:pick $range1 [:find $range1 "dfs"]]);
    :local flagpassive ([:pick $range1 [:find $range1 "passive"]]);
    :local flagindoor ([:pick $range1 [:find $range1 "indoor"]]);
    :local flagoutdoor ([:pick $range1 [:find $range1 "outdoor"]]);
    :put ($country .";". $startfreq .";". $endfreq  .";". $power  .";". $modes  .";". $flagdfs .";". $flagpassive .";". $flagindoor .";". $flagoutdoor);
  }
}

:put ("country;startfreq;endfreq;power;modes;dfs;passive;indoor;outdoor");
:foreach c in=(([/interface/wireless/info/country-list as-value])->"countries") do={
  :local buf "";
  :foreach r in=(([/interface/wireless/info/country-info $c as-value])->"ranges") do={
    :if ( [:find "0123456789" [:pick $r 0]] >= 0) do={
      $formatFreqRange country=$c range=$buf
      :set buf $r;
    } else={ :set buf ($buf . "," . $r); }
  }
  $formatFreqRange country=$c range=$buf
}
Turbo frequencies are filtered out as irrelevant.

Re: A script to dump country-info in spreadsheet-friendly format

Posted: Tue Mar 07, 2023 10:59 pm
by holvoetn
Works as advertised... on non-wifiwave2 devices.
You might want to specify that little detail :lol:

Re: A script to dump country-info in spreadsheet-friendly format

Posted: Wed Mar 08, 2023 1:23 am
by bpwl
# MSHARP 20200412
# Save the output of the wifipowerDB script to a txt file
# Solution found in the link below:
# https://forum.mikrotik.com/viewtopic.php?t=130448#p645867
{
:local a [/system script get wifipowerDB source]
:local outFile "wifipowerDB-to-csv.csv"
execute script=$a file=$outFile
E.G. If above dump script was called wifipowerDB .... execute this script ... Download wifipowerDB-to-csv.csv and use EXCEL filter ....