V
V
Vitaly2015-12-22 16:30:02
Mikrotik
Vitaly, 2015-12-22 16:30:02

How to use a script to search by rule id?

I'm trying to do something like this, but still an error with id

:put [/ip firewall nat get [find action=masquerade .id="*1" ] out-interface ];

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaliy, 2015-12-22
@Scorpiored88

Reached:
but for some reason it considers this id according to what the rule is. That is, I dragged that rule to the top itself, respectively, its id should be 0 or 1 and deleted other rules, now it is there alone, but its id is still 5, since that is the 5th rule that was created there.

S
Sergei E., 2015-12-22
@SmartFinn

If I understand correctly, .id is not suitable for this purpose, since in fact find is tasked with looking for action=masquerade in the first line. The solution looks like this:
From documentation:
return range of elements or substring. If end position is not specified, will return only one element from an array.
The countdown starts from zero.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question