i have 100 of HOTSPOT USER PROFILES
I want to get names of USER PROFILES starting with letter “M” and Sotre in to an arrry.
I can not manage script for that.
PLZ Help
Could Any one Plz Help Me//
This will get all user starting with m or M inn to array list
:local list [:toarray [/ip hotspot user find where (name~"^m" || name~"^M")]]
To see if it get correct user try this:
:put [/ip hotspot user print where (name~"^m" || name~"^M")]
To test it out the code, copy and past this to cli
[
:local list [:toarray [/ip hotspot user find where (name~"^m" || name~"^M")]]
:put $list
]
It will NOT give you the name, but the ID of the line with the name in that you can use later in the script.
So result would be some like this:
*2;*3;*5
So I have three user that begins with M
Thank You Very Much For Your Help.
I was Needed user Profile Names The script was on USER List …But Very Helpful., due to explaination.
I had tried a little, its working, but
if You please to Minimize this code,
{
:local list [:toarray [/ip hotspot user profile find (name~"^d" || name~"^D")]]
:local nameList;
:foreach u in=$list do={
:set nameList ($nameList, [/ip hotspot user profile get $u name]);
}
:put $nameList
}
You did miss where
[
:local list [/ip hotspot user profile find where name~"^[dD]"]
:local nameList;
:foreach u in=$list do={
:set nameList ($nameList, [/ip hotspot user profile get $u name])
}
:put $nameList
]
PS you can not use regex (?i) to search with case sensitive off. MT if your read this, please implement full regex.
But you can use [dD] to say it should be either d or D.