<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/8011" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2004-07-29T20:55:39-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/8011</id>

		<entry>
		<author><name><![CDATA[awyeah]]></name></author>
		<updated>2004-07-29T20:55:39-04:00</updated>

		<published>2004-07-29T20:55:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39228#p39228</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39228#p39228"/>
		<title type="html"><![CDATA[Searching from more than one File]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39228#p39228"><![CDATA[
Thats, why I say <strong class="text-strong">user</strong> is an elite scripter, here. I mean one of the best. I'm just a newbie.  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_mrgreen.gif" width="15" height="15" alt=":mrgreen:" title="Mr. Green"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4875">awyeah</a> — Thu Jul 29, 2004 8:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2004-07-29T14:31:25-04:00</updated>

		<published>2004-07-29T14:31:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39220#p39220</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39220#p39220"/>
		<title type="html"><![CDATA[Searching from more than one File]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39220#p39220"><![CDATA[
Thanx for your help guy's... <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><p>Statistics: Posted by Guest — Thu Jul 29, 2004 2:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2004-07-29T07:43:28-04:00</updated>

		<published>2004-07-29T07:43:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39211#p39211</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39211#p39211"/>
		<title type="html"><![CDATA[Try this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39211#p39211"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code># list of files to search:set findfiles [list search.txt search2.txt search3.txt search4.txt]set maxresults 10;# set to 0 for no limitbind pub - @find find:pubproc find:pub {n u h c a} {global findfiles maxresultsset a *[string map {" " *} $a]*set out {}foreach file $::findfiles {if {[catch {open $file} f]} {putlog "find:pub - You're a moron: $f"} {while {[gets $f b]&gt;-1} {if {[string match -nocase $a $b]} {lappend out $b}}close $f}}if {[set i [llength $out]]} {if {$maxresults&amp;&amp;$i&gt;$maxresults} {putserv "PRIVMSG $n :Found $i match[expr {$i==1?"":"es"}] (here's the first $maxresults):"set out [lrange $out 0 [expr {$maxresults-1}]]} {putserv "PRIVMSG $n :Found $i match[expr {$i==1?"":"es"}]:"}foreach b $out {putserv "PRIVMSG $n :$b"}} {putserv "PRIVMSG $n :No matches."}}</code></pre></div>awyeah: there's nothing wrong with opening several files at once (as long as you don't leave them open and forget about them), but in this particular case, reading the files one by makes the script more flexible. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Thu Jul 29, 2004 7:43 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[awyeah]]></name></author>
		<updated>2004-07-28T21:43:15-04:00</updated>

		<published>2004-07-28T21:43:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39192#p39192</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39192#p39192"/>
		<title type="html"><![CDATA[Searching from more than one File]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39192#p39192"><![CDATA[
Its like, first you open one file, read it then close it.<br>Then open another one, read it then close it.<br><br>You cannot open 2 at the same time and read, them<br>I guess. You always need to close the last opened file<br>to be able to open/read the new one. Otherwise you<br>will get errors.<br><br>Give, this a try maybe it will do your job:<br>(Otherwise, open, read and close one by one!)<br><div class="codebox"><p>Code: </p><pre><code>catch {close $file}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4875">awyeah</a> — Wed Jul 28, 2004 9:43 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2004-07-28T15:08:08-04:00</updated>

		<published>2004-07-28T15:08:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39182#p39182</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39182#p39182"/>
		<title type="html"><![CDATA[Searching from more than one File]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39182#p39182"><![CDATA[
hey a while back <em class="text-italics">User</em> posted some code here, and what he posted was something alone the lines of what i needed. But my question is can it be possible to have it search from more than one text file?<br><br>his code was:<br><div class="codebox"><p>Code: </p><pre><code>bind pub - @find find:pub proc find:pub {n u h c a} {   set a *[string map {" " *} $a]*   putserv "PRIVMSG $n :Searching for $a"   set i 0   set f [open "search.txt"]   while {[gets $f b]&gt;-1} {     if {[string match -nocase $a $b]} {       incr i       putserv "PRIVMSG $n :$b"     }   }   close $f   if {$i} {     putserv "PRIVMSG $n :Search complete found $i result[expr {$i==1?"":"s"}]"   } {     putserv "PRIVMSG $n :No matches."   } } </code></pre></div>what i'm woundering is how can i have it look around in 4 or 5 more files?<br>i tried adding some more calls but they all give errors:<br><div class="codebox"><p>Code: </p><pre><code>set m [open "search2.txt"] set p [open "search3.txt"] set x [open "search4.txt"] while {[gets $f,$m,$p,$x b]&gt;-1}close $mclose $pclose $x</code></pre></div>but all i get is errors.. can anyone help me out?<p>Statistics: Posted by Guest — Wed Jul 28, 2004 3:08 pm</p><hr />
]]></content>
	</entry>
	</feed>
