Code:
bind pub - !search search:pub
proc search:pub {n u h c a} {
set a *[string map {" " *} $a]*
putserv "PRIVMSG $n :Searching for \002$a\002.."
set i 0
set f [open "Uploads.log" r]
while {[gets $f b]>-1} {
if {[string match -nocase $a $b]} {
incr i
putserv "PRIVMSG $n :\002$i)\002 $b"
}
}
close $f
if {$i} {
putserv "PRIVMSG $n :Search complete.. Found \002$i\002 result[expr {$i==1?"":"s"}].."
} {
putserv "PRIVMSG $n :Sorry, no matches have been found."
}
}
Foloseste-l ca exemplu.