Community discussions

MikroTik App
 
611
newbie
Topic Author
Posts: 37
Joined: Wed Oct 17, 2018 10:12 am

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

Tue Mar 07, 2023 10:50 pm

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.
 
holvoetn
Forum Guru
Forum Guru
Posts: 5405
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

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

Tue Mar 07, 2023 10:59 pm

Works as advertised... on non-wifiwave2 devices.
You might want to specify that little detail :lol:
 
User avatar
bpwl
Forum Guru
Forum Guru
Posts: 2984
Joined: Mon Apr 08, 2019 1:16 am

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

Wed Mar 08, 2023 1:23 am

# 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 ....

Who is online

Users browsing this forum: Ahrefs [Bot] and 17 guests