OP
Hoopy frood
Joined: Aug 2005
Posts: 1,052 |
Well this is the long method code for my request that I did and results the proper result considering string 2 is being verified one by one in the if statements to the string 1 Syntax use: Inject 6 bytes in text file name it nume.txt stored in root dir, Inject 20 Bytes in text file name it let.txt stored in root dir, execute command /cycnum
alias cycnum {
%sixf = 0
var %x = 1
while (%x <= $lines(let.txt)) {
if ($wildtok($read(let.txt,%x),$gettok($read(nume.txt),1,32),0,32) == 1) {
inc %sixf
if (%rez) { %rez = %rez $wildtok($read(let.txt,%x),$gettok($read(nume.txt),1,32),1,32) }
else { %rez = $wildtok($read(let.txt,%x),$gettok($read(nume.txt),1,32),1,32) }
}
if ($wildtok($read(let.txt,%x),$gettok($read(nume.txt),2,32),0,32) == 1) {
inc %sixf
if (%rez) { %rez = %rez $wildtok($read(let.txt,%x),$gettok($read(nume.txt),2,32),1,32) }
else { %rez = $wildtok($read(let.txt,%x),$gettok($read(nume.txt),2,32),1,32) }
}
if ($wildtok($read(let.txt,%x),$gettok($read(nume.txt),3,32),0,32) == 1) {
inc %sixf
if (%rez) { %rez = %rez $wildtok($read(let.txt,%x),$gettok($read(nume.txt),3,32),1,32) }
else { %rez = $wildtok($read(let.txt,%x),$gettok($read(nume.txt),3,32),1,32) }
}
if ($wildtok($read(let.txt,%x),$gettok($read(nume.txt),4,32),0,32) == 1) {
inc %sixf
if (%rez) { %rez = %rez $wildtok($read(let.txt,%x),$gettok($read(nume.txt),4,32),1,32) }
else { %rez = $wildtok($read(let.txt,%x),$gettok($read(nume.txt),4,32),1,32) }
}
if ($wildtok($read(let.txt,%x),$gettok($read(nume.txt),5,32),0,32) == 1) {
inc %sixf
if (%rez) { %rez = %rez $wildtok($read(let.txt,%x),$gettok($read(nume.txt),5,32),1,32) }
else { %rez = $wildtok($read(let.txt,%x),$gettok($read(nume.txt),5,32),1,32) }
}
if ($wildtok($read(let.txt,%x),$gettok($read(nume.txt),6,32),0,32) == 1) {
inc %sixf
if (%rez) { %rez = %rez $wildtok($read(let.txt,%x),$gettok($read(nume.txt),6,32),1,32) }
else { %rez = $wildtok($read(let.txt,%x),$gettok($read(nume.txt),6,32),1,32) }
}
/echo -a 7,1Found --- %sixf --- Matches in --- $read(let.txt,%x) --- Result Match: $+ %rez
unset %sixf
unset %rez
inc %x
}
}
Or a Cleaner method like this but I still find the script a bit lenghty and think this could be done another way
alias cycCall { return $wildtok($read(let.txt,%x),$gettok($read(nume.txt),$1,32),$2,32) }
alias cycnum {
%sixf = 0
%x = 1
while (%x <= $lines(let.txt)) {
if ($cycCall(1,0) == 1) {
inc %sixf
if (%rez) { %rez = %rez $cycCall(1,1) }
else { %rez = $cycCall(1,1) }
}
if ($cycCall(2,0) == 1) {
inc %sixf
if (%rez) { %rez = %rez $cycCall(2,1) }
else { %rez = $cycCall(2,1) }
}
if ($cycCall(3,0) == 1) {
inc %sixf
if (%rez) { %rez = %rez $cycCall(3,1) }
else { %rez = $cycCall(3,1) }
}
if ($cycCall(4,0) == 1) {
inc %sixf
if (%rez) { %rez = %rez $cycCall(4,1) }
else { %rez = $cycCall(4,1) }
}
if ($cycCall(5,0) == 1) {
inc %sixf
if (%rez) { %rez = %rez $cycCall(5,1) }
else { %rez = $cycCall(5,1) }
}
if ($cycCall(6,0) == 1) {
inc %sixf
if (%rez) { %rez = %rez $cycCall(6,1) }
else { %rez = $cycCall(6,1) }
}
/echo -a 7,1Found --- %sixf --- Matches in --- $read(let.txt,%x) --- Result Match: $+ %rez
unset %sixf
unset %rez
inc %x
}
}
|