zivtal
February 9, 2018, 8:52pm
1
Hi,
I have several mangles that contain the work “incoming from” in his comment (for example: “prerouting incoming from ‘eth08client’ outgoing to ‘bridge-local’”), I would like to remove all [/ip firewall mangle] that contain the works “incoming from” in comment… there is a way to do it with foreach ?
There is, but you don’t have to use foreach at all. You can just use “find” to match the correct items:
/ip firewall mangle remove [find where comment~="incoming from"]
The “find” gets you IDs of all items that contain “incoming from” in comment, and “remove” then removes all of the matched IDs in one go.
zivtal
February 10, 2018, 1:57pm
3
Just check it and got an error
“missing value for where (line 1 column 48)”
There is, but you don’t have to use foreach at all. You can just use “find” to match the correct items:
/ip firewall mangle remove [find where comment~="incoming from"]
The “find” gets you IDs of all items that contain “incoming from” in comment, and “remove” then removes all of the matched IDs in one go.
fix Roll
/ip firewall mangle remove [find where comment=“incoming from”]
Oops… Sorry… It’s been a while since I’ve used the regex operator… It’s
/ip firewall mangle remove [find where comment=~"incoming from"]
(the “~” is AFTER the “=”, not before)
Without the “~”, you’d get items where the whole comment says “incoming from”, not a comment that has “incoming from” somewhere within it.