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

	<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>2003-09-12T02:25:16-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2003-09-12T02:25:16-04:00</updated>

		<published>2003-09-12T02:25:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=27001#p27001</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=27001#p27001"/>
		<title type="html"><![CDATA[edit file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=27001#p27001"><![CDATA[
if you mean read file then write<br><div class="codebox"><p>Code: </p><pre><code>##### READ #####set rfile [open "filname" "r"]set data [read $rfile]close $rfile</code></pre></div>and the contents of the file should be $data<br><div class="codebox"><p>Code: </p><pre><code>##### WRITE #####set wfile [open "filename" "w"]puts $wfile "$something"close</code></pre></div>this will overwrite all, but migh also write all to only one line and keep overwriting it so .., read on it in <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/contents.htm" class="postlink">tcl manual</a>, there is append as wel and you can add + add stuff after the "w" "r" or "a" <br><br>its just an example eh <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"> not sur that tis is what you wanted to do with it but ...<br>hope it gets you in the write direction he he<br><br>oh yes if you want to read it line by line you can also use while eof .. and gets to read the lines witch ever you prefer he he<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Fri Sep 12, 2003 2:25 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ribot]]></name></author>
		<updated>2003-09-12T01:49:24-04:00</updated>

		<published>2003-09-12T01:49:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=27000#p27000</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=27000#p27000"/>
		<title type="html"><![CDATA[edit file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=27000#p27000"><![CDATA[
how do i read it into memory?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3812">ribot</a> — Fri Sep 12, 2003 1:49 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-09-12T00:32:22-04:00</updated>

		<published>2003-09-12T00:32:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26994#p26994</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26994#p26994"/>
		<title type="html"><![CDATA[edit file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26994#p26994"><![CDATA[
Read the entire file in to memory, replace what you want then write it back to the file.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Fri Sep 12, 2003 12:32 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ribot]]></name></author>
		<updated>2003-09-12T00:10:16-04:00</updated>

		<published>2003-09-12T00:10:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=26992#p26992</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=26992#p26992"/>
		<title type="html"><![CDATA[edit file]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=26992#p26992"><![CDATA[
Hello <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>I have a file.txt with lists on each row such as:<br><div class="codebox"><p>Code: </p><pre><code>{pubm hello} {0 0}{pubm hi} {0 0}{pubm well} {pubm ok} {0 0}</code></pre></div>What I want to do is to change these 0:s. I want to know how I can change the line:<br>{pubm hi} {0 0}<br>to<br>{pubm hi} {1 0}<br>and still keep all above and below lines intact.<br><br>I figured out that I will:<br>set var [gets {pubm hi} {0 0}]<br>then change the var to {pubm hi} {1 0}<br>but then to write it i don't know! because puts will either write at the end of the file or delete all data in the file. but i want to delete that one line and replace it with a new. however it's not that important to rewrite the new line on the same line number, as long as the script won't make extra line breaks.<br><br>this file.txt might become several MB big so I would also know if there are some restrictions like if I have to put all text after {pubm hi} {0 0} in a variable, then how much text does a variable fit?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3812">ribot</a> — Fri Sep 12, 2003 12:10 am</p><hr />
]]></content>
	</entry>
	</feed>
