Community discussions

MikroTik App
 
billjellis
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 53
Joined: Mon Dec 15, 2014 11:04 pm

CLI specific hosts

Sat Jul 17, 2021 9:16 pm

I am trying to print out just the host names in DHCP-Server leases but cannot get this to work...
What am i not doing corectly?

/ip dhcp-server lease print where host-name="WLR*"

Thanks
Bill
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3291
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: CLI specific hosts

Sun Jul 18, 2021 5:42 pm

Not sure what you like as an output. When you search for WLR as a host-name, why do you like to just output the host-name, it will only be WLR?

Correct way in script is to use find and get
:put [/ip dhcp-server lease get [find where host-name="WLR"] host-name]
or expanded
{
local id [/ip dhcp-server lease find where host-name="WLR"]
local name [/ip dhcp-server lease get $id host-name]
:put $name
}

Who is online

Users browsing this forum: No registered users and 18 guests