Community discussions

 
tabate47
Member
Member
Topic Author
Posts: 435
Joined: Wed Mar 13, 2013 5:23 am
Location: Los Angeles

Need Assistance with Syntax

Sat Feb 02, 2019 7:15 am

I'm trying to create a script that will parse the comments of the ip table and look for entries that are not dynamic and not disabled, and do NOT contain the text "disregard". I cannot for the life of me find the proper syntax. Here is what I have:

:foreach vLease in=[/ip dhcp-server lease find where (!dynamic && !disabled) ] do={

Can someone help me with the syntax for the part that should not contain the text "disregard"?

Thank you.
 
tabate47
Member
Member
Topic Author
Posts: 435
Joined: Wed Mar 13, 2013 5:23 am
Location: Los Angeles

Re: Need Assistance with Syntax

Sat Feb 02, 2019 8:13 am

I have tried everything and searched the forum for hours and I cannot get it.
 
tabate47
Member
Member
Topic Author
Posts: 435
Joined: Wed Mar 13, 2013 5:23 am
Location: Los Angeles

Re: Need Assistance with Syntax

Sat Feb 02, 2019 9:15 am

Also, I'd like to be able to have any phrase that contains the word "disregard" skipped. For example, if the comment in a static lease that is not disabled is "disregard printer", that particular lease would be skipped in the script.
 
nostromog
Member Candidate
Member Candidate
Posts: 142
Joined: Wed Jul 18, 2018 3:39 pm

Re: Need Assistance with Syntax

Sat Feb 02, 2019 9:57 am

I thinks this should work
/ip dhcp-server lease print where !dynamic and !disabled and !(comment~"disregard")
I prefer it to:
ip dhcp-server lease print where !(dynamic) && !(disabled) && !(comment~"disregard")
For some reason the regex matching operator "~" requires parenthesis when negated.
Priorities of operators in the syntax is not very clear...
 
tabate47
Member
Member
Topic Author
Posts: 435
Joined: Wed Mar 13, 2013 5:23 am
Location: Los Angeles

Re: Need Assistance with Syntax

Sat Feb 02, 2019 9:59 am

Its crazy but I figured it out about 1 minute before you wrote me back.

Thank you for helping anyway.

I can't believe how difficult it was to find the syntax.

Thanks again.

Who is online

Users browsing this forum: Bing [Bot] and 95 guests