Enable and Disable IP addresses in address list

Hello friends, could you help me with a script that enables and disables any IP address that is in the address list. very grateful in advance for the help.
mikrotik.jpg

From a conceptual point of view: create two addresslists and move the entries accordingly.

Thanks for your answer friend. but I need the script is like this.

you’re not accurate in your description, a script can’t read your mind.

where = in the ip firewall address list
+
what to do = disable
+
on what = find “any IP address” (or better: all IPs, IP-prefixes, and DNS names)
+
where = where list name is equal to “test”

/ip firewall address-list disable [find where name="test"]

I think the TS wants to be able to enable/disable items on a list...which is, as far as I know, not possible.
Hence the idea of moving items in between 2 lists.

Unfortunately, the TS wants a script he can use immediately...

The items on address list can be disabled or enabled individually.

For disable / enable all togheter is this

/ip firewall address-list disable [find where name="test"]

/ip firewall address-list enable [find where name="test"]

But if the user want do that individually must be specified the IP / IP-prefix or DNS, or intervals...

/ip firewall address-list enable [find where list="test" and address=93.184.216.34]
/ip firewall address-list enable [find where list="test" and address=93.184.216.0/24]
/ip firewall address-list enable [find where list="test" and address="www.example.com"]
/ip firewall address-list enable [find where list="test" and address in 93.184.216.0/24]

Thanks for your answer REX, and if I want to enable or disable several IP addresses at the same time, for example, 10.1.1.2, 10.1.1.4, 10.1.1.5, how would it be?

One line for each, OBVIOUSLY…

Alternatively, set one or more tags inside the comment and disable only the IPs that have that TAG, for example:

enable single group
/ip firewall address-list enable [find where list=“test” and comment~“group5#”]

or

enable multiple group
/ip firewall address-list enable [find where list=“test” and comment~“(group1#|group7#)”]

each comment can have multiple tag / keyword forr example comment=“grup9# grup15# grup24#”

Each tag/keyword must not be part of other tag / keyword, for example #group2 match both #group2 and #group20, is why I put # at the end.
But if you use unique words, this problem probably do not happen, for example “holiday weekend midnight”,
but if you use “day” and “night” match also holiday and midnight…
etc.

It helped me like this, thanks friend REX

{
/ip firewall address-list disable [find where list="test" and address~"10.1.1.2|10.1.1.5|10.1.1.6"]
}



{
/ip firewall address-list enable [find where list="test" and address~"10.1.1.2|10.1.1.5|10.1.1.6"]
}

Love self love, might want to mark rextended as the best solution to give him the credits.
And sorry for not knowing this, learned from rextended again!

(★‿★)