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

	<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>2011-04-16T09:47:36-04:00</updated>

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

		<entry>
		<author><name><![CDATA[kenh83]]></name></author>
		<updated>2011-04-16T09:47:36-04:00</updated>

		<published>2011-04-16T09:47:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=96670#p96670</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=96670#p96670"/>
		<title type="html"><![CDATA[Read and Match something in a file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=96670#p96670"><![CDATA[
Willyw, <br><br>Thanks very much kind sir!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11350">kenh83</a> — Sat Apr 16, 2011 9:47 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[willyw]]></name></author>
		<updated>2011-04-16T00:26:22-04:00</updated>

		<published>2011-04-16T00:26:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=96668#p96668</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=96668#p96668"/>
		<title type="html"><![CDATA[Re: Read and Match something in a file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=96668#p96668"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code># Set the path and filename of text file to readset file2read "you/need/to/edit/this/path/file_to_read.txt"bind pub - "!readfile" readfileproc readfile {nick uhost handle chan text} {  global file2read  if {![file exists $file2read]} {    putserv "privmsg $chan :Sorry, $file2read does not exist"    } else {    set fname "$file2read"    set fp [open $fname "r"]    set data [read -nonewline $fp]    close $fp    set lines [split $data "\n"]     if {[lsearch -exact -nocase -inline -all -index 0 $lines $text] != ""} {      putserv "privmsg $chan :[join [lsearch -exact -nocase -inline -all -index 0 $lines $text]]"      } else {      putserv "privmsg $chan :Sorry, $text not found"    }  }  }putlog "Please see:  http://forum.egghelp.org/viewtopic.php?t=18428"# ref: http://forum.egghelp.org/viewtopic.php?t=6885#      http://www.tcl.tk/man/tcl8.5/TclCmd/lsearch.htm</code></pre></div>In channel with bot, do:<br>!readfile Ted<br>for example, and bot will reply in the channel.<br><br>Tested briefly.  It worked.<br>Am not saying that I thought of every possibility when testing.  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>There are probably lots of things that could be done, to improve it.<br>So it will be interesting to see what else gets posted here.<br><br>I hope this helps. You seemed like you just wanted a rough idea, to get you started. That's all this is.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10420">willyw</a> — Sat Apr 16, 2011 12:26 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[kenh83]]></name></author>
		<updated>2011-04-15T22:23:37-04:00</updated>

		<published>2011-04-15T22:23:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=96667#p96667</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=96667#p96667"/>
		<title type="html"><![CDATA[Read and Match something in a file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=96667#p96667"><![CDATA[
I'm stumped on how to read a file, to match something in the file and return the line of text that's in that file.<br><br>example.. say I have a file that contains the following information<br><br>Ted 250<br>John 291<br>Bill 301<br><br>How can I READ this file and say, I only want to match the line that contains matching text to TED -- thus it would output 'Ted 250'<br><br>Please help <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=11350">kenh83</a> — Fri Apr 15, 2011 10:23 pm</p><hr />
]]></content>
	</entry>
	</feed>
