Hello, I made this script to find the second value found in the file pagos.txt, what I did was convert it to a string, but I can not make it work properly, I leave the script file and example payments to see if someone can give me a hand to finish
:if ( [/file get [/file find name=pagos.txt] size] > 0 ) do={
:global content [/file get [/file find name=pagos.txt] contents] ;
:global contentLen [ :len $content ] ;
:global lineEnd 0;
:global line "";
:global lastEnd 0;
:do {
:set lineEnd [:find $content "\n" $lastEnd ] ;
:set line [:pick $content $lastEnd $lineEnd] ;
:set lastEnd ( $lineEnd + 1 ) ;
#If the line doesn't start with a hash then process and add to the list
:if ( [:pick $line 0 1] != "#" ) do={
:local entry [:pick $line 0 ($lineEnd -1) ]
:if ( [:len $entry ] > 0 ) do={
:set tmpArray [:toarray $line] ;
:set cliente [:pick $tmpArray 1];
:set clienteIP [ /ip address get [/ip address find comment=$cliente] value-name=network ];
/ip firewall address-list add address=($clienteIP . "/29") comment=$cliente list="PAGOS";
}
}
} while ($lineEnd < $contentLen)
}
The content of pagos is like this:
180.00,CALANDRIA1691FDO,1
70.00,MZ35D72A,2
The value i need to compare is for example CALANDRIA1691FDO
Bye
Ps: Sorry my poor english