edit:add-var addbadips~ [@argv]{ use moi/util/ip use moi/util/list use moi/util/map use str var f = ~/bad_ips.txt var ips = [ (cat $f) ] var m c = (map:to-set $ips) 0 each [e]{ var cond = (and (not (has-key $m $e)) (ip:is-ipv4 $e)) if $cond { echo $e ajoutée c = (+ $c 1) m[$e] = $nil ips = [ (all $ips) $e ] } } $argv if (> $c 0) { ips = [ (list:sort $ip:cmp4~ $ips) ] } var result = (str:join "\n" $ips) echo $result > $f echo $c' IPs ajoutées ('(count $ips)' au total)' }