I have another problem I need some help with. I want to write a script which resolves a host and adds the address to an address list so that it can be used in firewall rules. Of course I need to delete the old entries first, which I want to do by comment (as some entries of the same list are static and don’t need updating). But when I try
Use another local variable other than ‘comment’ and see if it solves it. RouterOS script engine apparently runs into problem when you try to call a variable with the same name as some other part of the argument.
/ip firewall address-list remove [find where list="list-name"]
and the OP is “Remove Address List Entry by Comment” so:
/ip firewall address-list remove [find where comment="the comment"]
but that delete only when the comment is EXACTLY “the comment” (case sensitive)
for delete when a part of the comment is abcde (case sensitive):
/ip firewall address-list remove [find where comment~"abcde"]
but if they need to be deleted regularly, it is better to import them as dynamic, so they are not written in export and do not wearing the internal flash,
they are lost upon reboot, and they are automatically deleted after the time set to your liking.