i have found a script here in the forum to search a txt file line by line and post the results if $arg is in this file.
My sample txt file looks like
---------------------------------
boardseek => http://any.url.com
help-agent => this is a text
---------------------------------
I modified it to my needs as shown below and when I search after "board" or "boardseek" i get the correct result "boardseek".
But when i search after "help" or "help-agent" i get nothing

Why?
Code: Select all
# header and copyright......
# .....
#
set cd_release "{./scripts/myfile.txt}"
set rlsmaxsearch 10
set cmdsearch "!search"
set rlsflag ""
if {$rlsflag == ""} {set rlsflag "-"}
bind pub $rlsflag $cmdsearch pub:rlslocate
proc pub:rlslocate {nick uhost handle chan arg} {
global rlsmaxsearch cd_release
if {[lindex $arg 0] == ""} {puthelp "PRIVMSG $chan :Syntax: $cmdsearch <Suchwort>" ;return 0}
set totrlsfound 0
foreach database $cd_release {
set rlsfile [open $database r]
while {![eof $rlsfile]} {
set rlsline [gets $rlsfile]
if {[string match "*[string tolower [lindex $arg 0]]*" [string tolower $rlsline]]} {
incr totrlsfound 1
if {$totrlsfound < $rlsmaxsearch} {
puthelp "PRIVMSG $chan :$totrlsfound. Teffer: [lindex $rlsline 0]"
}
}
}
close $rlsfile
}
if {$totrlsfound > $rlsmaxsearch} {puthelp "$PRIVMSG $chan :$nick: Es gab mehr wie $rlsmaxsearch Treffer. Bitte etwas eingrenzen!"}
if {$totrlsfound == "0" } {puthelp "PRIVMSG $chan :$nick: Es gab $totrlsfound Einträge, die deiner Suchanfrage entsprachen."}
if {$totrlsfound == "1" } {puthelp "PRIVMSG $chan :$nick: Es gab $totrlsfound Eintrag, der deiner Suchanfrage entsprach."}
if {$totrlsfound >= 2 } {puthelp "PRIVMSG $chan :$nick: Es gab $totrlsfound Einträge, die deiner Suchanfrage entsprachen."}
}