Can I search for content within a file?
Code:
/ip firewall address-list:foreach id in=[find list=servers] do={ :local ipAddr [:toip [get $id address]] :local filenameIP "servers100.txt" /file :if ([:len [find where name="flash" and type="disk"]] = 1) do={:set filenameIP "flash/$filenameIP"} :if ([:len [find where name=$filenameIP]] = 0) do={print file="$filenameIP"; :delay 2s; set $filenameIP contents=""} :local filecontent [get $filenameIP contents] :foreach id2 in=[$filecontent] do={ :if ((($ipAddr in $id2) or ($ipAddr = $id2)) = 0) do={ >>>>> NOT WORKING <<<<<<< } } < :local newfilecontent "$ipAddr\r\n$filecontent" set $filenameIP contents=$newfilecontent; :delay 1s}
Statistics: Posted by diamuxin — Fri Jan 26, 2024 9:44 pm