I have a file which contains a kind of addressbook eg:
1 Robert Cook Road_Seven_98 Beverly_Hills 081023445
2 Peter Cook Road_Seven_98 Beverly_Hills 08934752435
end so on.
The format of this file is Identifier [SPACE] Firstname [SPACE] Lastname [SPACE] Address [SPACE] City [Space] Phonenumber
I'd like to have an IRC script which provide me the info of a person based on the identifier by example in IRC i do /msg botnick address1 and that the bot answers with the line 1 of the file
Could anyone help me, I'm not a TCL specialist and I get stuck after trying several things
I guess you could approach this in several different ways, I'd suggest you open the file and read it line by line, using a "while {![eof $fid]} {.." loop.
Then split each line into a list, and use lindex to extract the identifier number. If it matches, print the line, otherwize move on to the next line.