I'm very new at tcl scripting, sure I made some simple !op !topic scripts but now I want to try something more advanced.
I'd like to be able to use a command like
!search stringtofind and then have the script search through a textfile for a line beginning with stringtofind and then msg it to the person who gave the command.
Personally I wouldn't dump the text to server and continue reading the file like that. I'd put each matching line into a list, and then evaluate how long that list is before dumping each individual line to the server. This way, if like 1000 lines match, its possible, for example, to dump out only the first 5 lines (or maybe 5 random lines).
Papillon - it's good, but you should check for eof after gets not before (although in this case it doesn't really matter). Also, the code is generally faster if you use read/split instead of a loop.