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

	<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-05T16:33:00-04:00</updated>

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

		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2002-06-05T16:33:00-04:00</updated>

		<published>2002-06-05T16:33:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7705#p7705</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7705#p7705"/>
		<title type="html"><![CDATA[reading a specific line from a textfile]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7705#p7705"><![CDATA[
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.<br><div class="codebox"><p>Code: </p><pre><code>set fp [open $file r]set lines [split [read $fp n]close $fpset i [lsearch -glob $lines "$sometext*"]if {$i != -1} {  putserv "privmsg $nick :[lindex $lines $i]} else {  putserv "privmsg $nick :not found!"}</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 4:33 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Petersen]]></name></author>
		<updated>2002-06-05T14:34:00-04:00</updated>

		<published>2002-06-05T14:34:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7701#p7701</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7701#p7701"/>
		<title type="html"><![CDATA[reading a specific line from a textfile]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7701#p7701"><![CDATA[
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).<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=60">Petersen</a> — Wed Jun 05, 2002 2:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Papillon]]></name></author>
		<updated>2002-06-05T13:27:00-04:00</updated>

		<published>2002-06-05T13:27:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7699#p7699</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7699#p7699"/>
		<title type="html"><![CDATA[reading a specific line from a textfile]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7699#p7699"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set fs [open $file r]  while {![eof $fs]} {     gets $fs line     if {[string match "stringtofind*" $line]} {      putserv "PRIVMSG $nick :$line"     }  }</code></pre></div>try that one...<br>_________________<br>Elen sila lúmenn' omentielvo<br><br>&lt;font size=-1&gt;[ This Message was edited by: Papillon on 2002-06-05 11:29 ]&lt;/font&gt;<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=852">Papillon</a> — Wed Jun 05, 2002 1:27 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-06-05T08:18:00-04:00</updated>

		<published>2002-06-05T08:18:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7688#p7688</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7688#p7688"/>
		<title type="html"><![CDATA[reading a specific line from a textfile]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7688#p7688"><![CDATA[
Hello,<br><br>I'm very new at tcl scripting, sure I made some simple !op !topic scripts but now I want to try something more advanced.<br><br>I'd like to be able to use a command like<br>!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.<br><br>How do I go about this ?<br><br>thx!<br>Quinten<p>Statistics: Posted by Guest — Wed Jun 05, 2002 8:18 am</p><hr />
]]></content>
	</entry>
	</feed>
