Community discussions

MikroTik App
 
dotis
just joined
Topic Author
Posts: 1
Joined: Wed Apr 22, 2015 11:48 am

Print Command

Mon Jan 16, 2017 4:18 pm

Hello there
i want to get in print command only the one column results.
ip interface print , BUT to get only the NAME
or
ip hotspot user print , and AGAIN ONLY the usernames
How is that possible?
Thank you!
 
User avatar
PaulsMT
MikroTik Support
MikroTik Support
Posts: 283
Joined: Tue Feb 10, 2015 3:21 pm

Re: Print Command

Tue Jan 17, 2017 10:17 am

Hello there
i want to get in print command only the one column results.
ip interface print , BUT to get only the NAME
or
ip hotspot user print , and AGAIN ONLY the usernames
How is that possible?
Thank you!
foreach a in=[/interface find] do={:put [interface get $a name]}
 
brg3466
Member Candidate
Member Candidate
Posts: 102
Joined: Sat Aug 01, 2015 7:29 am

Re: Print Command

Thu Feb 04, 2021 7:35 am

Hi,
I have a similar question it is not print the output in the terminal , but to the array.

Let's say ,
> :global a [/interface print as-value] , and you will get an array with all the interfaces info,

If I just want to get the names of the interface in the array, how to get it ?
the expected result kind of like: a={ ether1;ether2; .. ; wlan1} or a={ {ether1}; {ether2}; ..., {wlan1} }

Thank you !
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 1915
Joined: Sat Dec 24, 2016 11:17 am
Location: jo.overland at gmail.com

Re: Print Command

Fri Feb 05, 2021 1:35 pm

Not exactly sure what you like to do.

This will get all interface in to array list and then print it:
{
:local list
 /interface ethernet
 :foreach i in=[find] do={
	:set list ($list,[get $i name])
	} 
:put $list
}
ether1;ether2;ether3;ether4;ether5

I do not think you can use as-value with multi line.

This works
:put ([/system clock print as-value ]->"date")          
feb/05/2021
Not OK
:put ([/interface ethernet print as-value ]->"name")
 
Why do not use Splunk to monitor your MikroTik Router(s)? Look at this page in how to set it up.

MikroTik->Splunk
 
 
brg3466
Member Candidate
Member Candidate
Posts: 102
Joined: Sat Aug 01, 2015 7:29 am

Re: Print Command

Fri Feb 05, 2021 9:50 pm

This will get all interface in to array list and then print it:
This is exactly what I want. I tried with "print as-value" but no luck. Looks like it is not possible to "print as-value" for only one properties/field.
Thank you !

Who is online

Users browsing this forum: No registered users and 25 guests