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

	<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>2007-05-18T12:41:21-04:00</updated>

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

		<entry>
		<author><name><![CDATA[blip2]]></name></author>
		<updated>2007-05-18T12:41:21-04:00</updated>

		<published>2007-05-18T12:41:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72822#p72822</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72822#p72822"/>
		<title type="html"><![CDATA[Removing lines from text file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72822#p72822"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set fname "files/requests.txt"set fp [open $fname "r"]set data [read -nonewline $fp]set lines [split $data "\n"]close $fpwhile {[set i [lsearch -glob $lines $text]]&gt;-1} {  set lines [lreplace $lines $i $i]}set fp [open $fname "w"]puts $fp [join $lines "\n"]close $fp</code></pre></div> <br>seems to be ok now? but does the code look ok? or could it be tidied up a bit?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9002">blip2</a> — Fri May 18, 2007 12:41 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-05-18T12:33:49-04:00</updated>

		<published>2007-05-18T12:33:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72821#p72821</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72821#p72821"/>
		<title type="html"><![CDATA[Removing lines from text file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72821#p72821"><![CDATA[
You still trunk the file when opening it for writing (which is what you'd most likely want), but you still fail to write anything to it...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Fri May 18, 2007 12:33 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[blip2]]></name></author>
		<updated>2007-05-18T12:29:58-04:00</updated>

		<published>2007-05-18T12:29:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72820#p72820</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72820#p72820"/>
		<title type="html"><![CDATA[Removing lines from text file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72820#p72820"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set fname "files/requests.txt"set fp [open $fname "r"]set data [read -nonewline $fp]set lines [split $data "\n"]=close $fpset fp [open $fname "w"]while {[set i [lsearch -glob $lines $text]]&gt;-1} {  set lines [lreplace $lines $i $i]}close $fp</code></pre></div> <br>now got that but it still deletes all the lines. not just the one that is stated in $text<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9002">blip2</a> — Fri May 18, 2007 12:29 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2007-05-18T10:55:20-04:00</updated>

		<published>2007-05-18T10:55:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72816#p72816</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72816#p72816"/>
		<title type="html"><![CDATA[Re: Removing lines from text file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72816#p72816"><![CDATA[
<blockquote class="uncited"><div>Does anyone know what's going wrong?</div></blockquote>You truncate the file when you open it (so there will be no data to read) and you never write anything back to the file.<br><br><a href="http://tcl.tk/man/tcl8.3/TclCmd/open.htm#M8" class="postlink">http://tcl.tk/man/tcl8.3/TclCmd/open.htm#M8</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Fri May 18, 2007 10:55 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[blip2]]></name></author>
		<updated>2007-05-18T09:59:03-04:00</updated>

		<published>2007-05-18T09:59:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72813#p72813</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72813#p72813"/>
		<title type="html"><![CDATA[Removing lines from text file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72813#p72813"><![CDATA[
I Have a list in a file called requests.txt which looks like this:<br>#Test<br>#Test2<br>#Test3<br>#Test4<br>#Test5<br>#Test6<br>(etc)<br>When i use a !trigger from a channel to remove a certain word from the file it deletes every line in the file instead of the match and here is what i have:<div class="codebox"><p>Code: </p><pre><code>set fname "files/requests.txt"set fp [open $fname "w+"]set data [read -nonewline $fp]set lines [split $data "\n"]while {[set i [lsearch -glob $lines $text]]&gt;-1} {set lines [lreplace $lines $i $i]}close $fp</code></pre></div>Does anyone know what's going wrong?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9002">blip2</a> — Fri May 18, 2007 9:59 am</p><hr />
]]></content>
	</entry>
	</feed>
