<?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/1874" />

	<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>2002-06-05T20:29:00-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Petersen]]></name></author>
		<updated>2002-06-05T20:29:00-04:00</updated>

		<published>2002-06-05T20:29:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7722#p7722</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7722#p7722"/>
		<title type="html"><![CDATA[Some help pleez if possible]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7722#p7722"><![CDATA[
well yah, once you get to that size of unindexed sequential file everything is gonna be slow. grep is still quicker than tcl though <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":razz:" title="Razz"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=60">Petersen</a> — Wed Jun 05, 2002 8:29 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2002-06-05T16:29:00-04:00</updated>

		<published>2002-06-05T16:29:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7703#p7703</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7703#p7703"/>
		<title type="html"><![CDATA[Some help pleez if possible]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7703#p7703"><![CDATA[
Ah I see, you mean Tcl's file performance is crap. When you said "file handling" I thought you meant the api. Yeah, Tcl is obviously much slower than C.<br><br>But anyway, unless you have thousands of url's to check, my way is still faster than exec grep. It also won't interfere with process limits on your shell. And it's always gonna be more portable <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>On the performance issue, I think one should note that grep is also going to be slow on a 500 meg file. When you get to the point of having such a large file, you should use a real database like mysql, not a flat text file and grep.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Wed Jun 05, 2002 4:29 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Petersen]]></name></author>
		<updated>2002-06-05T10:39:00-04:00</updated>

		<published>2002-06-05T10:39:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7692#p7692</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7692#p7692"/>
		<title type="html"><![CDATA[Some help pleez if possible]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7692#p7692"><![CDATA[
yes, then you could use a sequential read, eval, readnext algorithm, but I guarantee it won't be anywhere near the speed of a pure c implemenation, simply due to the overhead of the interpreter running in a while loop. Using external pure c modules (such as grep) in my mind is always preferable than using the scripted alternative. Yes, in this case, the performance increase is probably negligable, but thats no reason not to code it the most efficient way possible (well, technically, the most efficient way would be to build a simple grep as a tcl module, but thats going a little to extreme just to avoid the overhead of exec)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=60">Petersen</a> — Wed Jun 05, 2002 10:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2002-06-05T06:52:00-04:00</updated>

		<published>2002-06-05T06:52:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7687#p7687</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7687#p7687"/>
		<title type="html"><![CDATA[Some help pleez if possible]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7687#p7687"><![CDATA[
I see. Well, that's less Tcl's fault than the algorithm you use to scan through the file. The Tcl file api (gets, read, puts, seek, tell, eof, etc) is pretty much the same as any other language's, including C's. I doubt his file is 500 meg though, so the algorithm isn't very important <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=8">stdragon</a> — Wed Jun 05, 2002 6:52 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Petersen]]></name></author>
		<updated>2002-06-05T06:42:00-04:00</updated>

		<published>2002-06-05T06:42:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7685#p7685</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7685#p7685"/>
		<title type="html"><![CDATA[Some help pleez if possible]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7685#p7685"><![CDATA[
try running that script on a 500meg file and see what I mean <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":razz:" title="Razz"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=60">Petersen</a> — Wed Jun 05, 2002 6:42 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2002-06-05T02:55:00-04:00</updated>

		<published>2002-06-05T02:55:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7672#p7672</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7672#p7672"/>
		<title type="html"><![CDATA[Some help pleez if possible]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7672#p7672"><![CDATA[
Petersen, what are you talking about?? Tcl has great file handling.<br><br>Nero, you need something like this:<div class="codebox"><p>Code: </p><pre><code># Returns -1 if not found, otherwise it's a dupeproc scan_tempfile {url} {  set fp [open tempfile r]  set lines [split [string tolower [read $fp]] n]  close $fp  return [lsearch -exact $lines [string tolower $url]]}if {[scan_tempfile "http://hotsheep.com"] == -1} {  putserv "privmsg somechan :that's a dupe :("} else {  putserv "adding to file..."  blah blah}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Wed Jun 05, 2002 2:55 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Petersen]]></name></author>
		<updated>2002-06-04T17:53:00-04:00</updated>

		<published>2002-06-04T17:53:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7662#p7662</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7662#p7662"/>
		<title type="html"><![CDATA[Some help pleez if possible]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7662#p7662"><![CDATA[
and as I keep saying, use grep, cos tcl's file handling is crap<br><br>set file templist<br>if {![catch {exec grep -i $url $file}]} { <br>puthelp "PRIVMSG $chan : was found!" <br>} else { <br>puthelp "PRIVMSG $chan : was not found." <br>} <br><br><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=60">Petersen</a> — Tue Jun 04, 2002 5:53 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[[Nero]]]></name></author>
		<updated>2002-06-04T16:47:00-04:00</updated>

		<published>2002-06-04T16:47:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7660#p7660</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7660#p7660"/>
		<title type="html"><![CDATA[Some help pleez if possible]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7660#p7660"><![CDATA[
I think were at differenty posts here i was looking at the Grep Scripts.<br>what i need is ...<br>I have a list of urls in a .txt file<br>i want users to be able to add urls to the .txt file via my tcl script but i want the tcl to check to see if the submitted url is in the list already if so, say in the channel that its a dupe, if it isnt in the .txt file then add it, is that possible in tcl ??<br><br>I thought this would work but it wont find the dupe although the dupe is in the templist.txt<br><br>set file templist<br>set found 0 <br>set fs [open $file r] <br>while {![eof $fs]} { <br>  gets $fs line <br>  if {$line == $nick} { set found 1 } <br>} <br>close $fs <br>if {$found} { <br>  puthelp "PRIVMSG $chan : was found!" <br>} else { <br>  puthelp "PRIVMSG $chan : was not found." <br>} <br>Thanx again<br><br>&lt;font size=-1&gt;[ This Message was edited by: [Nero] on 2002-06-04 14:50 ]&lt;/font&gt;<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1317">[Nero]</a> — Tue Jun 04, 2002 4:47 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Petersen]]></name></author>
		<updated>2002-06-04T16:37:00-04:00</updated>

		<published>2002-06-04T16:37:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7658#p7658</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7658#p7658"/>
		<title type="html"><![CDATA[Some help pleez if possible]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7658#p7658"><![CDATA[
catch {exec grep -i $url $file}<br><br>whats so big about that? returns 1 if nomatch, 0 if match<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=60">Petersen</a> — Tue Jun 04, 2002 4:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[[Nero]]]></name></author>
		<updated>2002-06-04T15:24:00-04:00</updated>

		<published>2002-06-04T15:24:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7657#p7657</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7657#p7657"/>
		<title type="html"><![CDATA[Some help pleez if possible]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7657#p7657"><![CDATA[
I understand what your saying &amp; have looked at grep but its too big just to look in a text file to see if the url that i want to add is already in the text file, but thank you for your help though, i appreciate it<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1317">[Nero]</a> — Tue Jun 04, 2002 3:24 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Petersen]]></name></author>
		<updated>2002-06-04T14:26:00-04:00</updated>

		<published>2002-06-04T14:26:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7656#p7656</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7656#p7656"/>
		<title type="html"><![CDATA[Some help pleez if possible]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7656#p7656"><![CDATA[
and still, the easiest way is with grep. file reading in tcl is inefficient at the best of times, so why do it when you don't have to?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=60">Petersen</a> — Tue Jun 04, 2002 2:26 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[[Nero]]]></name></author>
		<updated>2002-06-04T14:09:00-04:00</updated>

		<published>2002-06-04T14:09:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7654#p7654</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7654#p7654"/>
		<title type="html"><![CDATA[Some help pleez if possible]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7654#p7654"><![CDATA[
LOL - no im looking for a bit of script that will search a url list for a specific url<br><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1317">[Nero]</a> — Tue Jun 04, 2002 2:09 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Petersen]]></name></author>
		<updated>2002-06-04T12:59:00-04:00</updated>

		<published>2002-06-04T12:59:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7651#p7651</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7651#p7651"/>
		<title type="html"><![CDATA[Some help pleez if possible]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7651#p7651"><![CDATA[
with grep<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=60">Petersen</a> — Tue Jun 04, 2002 12:59 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[[Nero]]]></name></author>
		<updated>2002-06-04T12:14:00-04:00</updated>

		<published>2002-06-04T12:14:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7648#p7648</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7648#p7648"/>
		<title type="html"><![CDATA[Some help pleez if possible]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7648#p7648"><![CDATA[
Ive Sussed it Myself,<br> can anyone tell me how to search a text file for a string ?? please<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1317">[Nero]</a> — Tue Jun 04, 2002 12:14 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[[Nero]]]></name></author>
		<updated>2002-06-04T07:28:00-04:00</updated>

		<published>2002-06-04T07:28:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7642#p7642</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7642#p7642"/>
		<title type="html"><![CDATA[Some help pleez if possible]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7642#p7642"><![CDATA[
Could someone tell me why i keep getting "Invalid idx" with this bit of script, please, Many thanx<br><br>proc postsite {nick idx uhost arg} {<br>global botname chan templist lasttempsite isopen tempnumber<br>if {$isopen == 0} {<br>putserv "NOTICE $nick : Please Read the Topic !!, $botname is Currently Closed, Try Again Later."<br>return 0<br>} else {<br>puthelp "PRIVMSG $chan :razz:ossible new Site &lt;$tempnumber&gt; by $nick"<br>putserv "NOTICE $nick : Please Wait While an OP Checks your Site Number &lt;$tempnumber&gt;"<br>putdcc $idx "OPS Check this site Pleez"<br>}<br>}<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1317">[Nero]</a> — Tue Jun 04, 2002 7:28 am</p><hr />
]]></content>
	</entry>
	</feed>
