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

	<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-10-08T23:18:10-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2003-10-08T23:18:10-04:00</updated>

		<published>2003-10-08T23:18:10-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=28182#p28182</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=28182#p28182"/>
		<title type="html"><![CDATA[Read/Write specific line]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=28182#p28182"><![CDATA[
i can't be sur because i don't know what the imput is i tryed various combinations<br><br>like file start end ..<br><br>i get stuff like this is not an integer ..<br><br>i know that doens't make the script wrong its me i know that but just not sur what this exactly means <br><br># Usage: replaceLines &lt;file&gt; &lt;first line&gt; &lt;last line&gt; [replacement data (optional)]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Wed Oct 08, 2003 11:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-10-08T19:30:36-04:00</updated>

		<published>2003-10-08T19:30:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=28177#p28177</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=28177#p28177"/>
		<title type="html"><![CDATA[Read/Write specific line]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=28177#p28177"><![CDATA[
<blockquote class="uncited"><div>could you give me a write syntax cause ive been reading the manual on lreplace and trying to understand it but i am affraid my knowledge about this topic isn't what it supposed to be to understand the therms that are being used ?<br><br>so what is the input syntax for your script ? i always get funny out puts :/</div></blockquote>I wrote a line on how to use the last two procs (re-read my post). There might be bugs in my code though (I didn't test it iirc <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz">) Give me a example of what you're doing and what you expect as a result and I'll try to help you on the right track <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=2878">user</a> — Wed Oct 08, 2003 7:30 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-10-08T19:28:54-04:00</updated>

		<published>2003-10-08T19:28:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=28176#p28176</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=28176#p28176"/>
		<title type="html"><![CDATA[Read/Write specific line]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=28176#p28176"><![CDATA[
<blockquote class="uncited"><div><blockquote class="uncited"><div>proc getLine {file line} {lindex [split [read [set f [open $file]]][close $f] \n] $line}</div></blockquote>Heh why do you obfuscate things so much? There's really nothing wrong with using a few more lines <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"></div></blockquote>Actually, in this case the "ubfuscation" was for a reason. If I were to store the contents of the file in a variable, the proc would require 2*[file size $file] to execute (because a copy of the data is passed along to the commands when variable substitution is performed (at least that's how it is in older tcl versions))<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Wed Oct 08, 2003 7:28 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2003-10-08T16:48:11-04:00</updated>

		<published>2003-10-08T16:48:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=28174#p28174</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=28174#p28174"/>
		<title type="html"><![CDATA[Read/Write specific line]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=28174#p28174"><![CDATA[
could you give me a write syntax cause ive been reading the manual on lreplace and trying to understand it but i am affraid my knowledge about this topic isn't what it supposed to be to understand the therms that are being used ?<br><br>so what is the input syntax for your script ? i always get funny out puts :/<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Wed Oct 08, 2003 4:48 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2003-09-28T14:22:47-04:00</updated>

		<published>2003-09-28T14:22:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=27678#p27678</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=27678#p27678"/>
		<title type="html"><![CDATA[Read/Write specific line]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=27678#p27678"><![CDATA[
might sound stupid, but i am supposed to open the file write before i do this and close after ... and do i require to use it in a while or just like that ...<br><blockquote class="uncited"><div># Fetch a single line <br>proc getLine {file line} {lindex [split [read [set f [open $file]]][close $f] \n] $line}</div></blockquote><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Sun Sep 28, 2003 2:22 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2003-09-28T14:17:39-04:00</updated>

		<published>2003-09-28T14:17:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=27676#p27676</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=27676#p27676"/>
		<title type="html"><![CDATA[Read/Write specific line]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=27676#p27676"><![CDATA[
tnx verry mutch ima try it test it abuse it .. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> and ill let you know if something is wrong hehe<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Sun Sep 28, 2003 2:17 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2003-09-27T20:05:08-04:00</updated>

		<published>2003-09-27T20:05:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=27639#p27639</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=27639#p27639"/>
		<title type="html"><![CDATA[Read/Write specific line]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=27639#p27639"><![CDATA[
<blockquote class="uncited"><div># Fetch a single line <br>proc getLine {file line} {lindex [split [read [set f [open $file]]][close $f] \n] $line}</div></blockquote>Heh why do you obfuscate things so much? There's really nothing wrong with using a few more lines :)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Sat Sep 27, 2003 8:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-09-26T21:32:31-04:00</updated>

		<published>2003-09-26T21:32:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=27613#p27613</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=27613#p27613"/>
		<title type="html"><![CDATA[Read/Write specific line]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=27613#p27613"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code># Fetch a single lineproc getLine {file line} {lindex [split [read [set f [open $file]]][close $f] \n] $line}# Insert data at the given line# Accepts the same values for line number as 'linsert' does for index (check your manual)# Will create the file if it doesn't exist.proc addLine {file line data} {if {[file readable $file]} {set d [split [read [set f [open $file r+]]] \n]seek $f 0} {set d ""set f [open $file w]}puts -nonewline $f [join [linsert $d $line $data] \n]close $f}# Replace one or more lines# Usage: replaceLines &lt;file&gt; &lt;first line&gt; &lt;last line&gt; [replacement data (optional)]# Accepts the same values for indexes as 'lreplace' (check your manual)proc replaceLines {args} {if {[llength $args]&gt;=3} {foreach {file start end} $args breakset cmd [list lreplace [split [read [set f [open $file r]]] \n] $start $end]close $fif {[llength $args]&gt;3} {lappend cmd [lindex $args 3]}puts -nonewline [set f [open $file w]] [join [eval $cmd] \n]close $f} {error "wrong # args: should be \"[lindex [info level 0] 0] file start end ?replacement?\""}}</code></pre></div>...btw: line numbers are zero-based, like lists, meaning the first line is called "0" <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=2878">user</a> — Fri Sep 26, 2003 9:32 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2003-09-26T17:51:43-04:00</updated>

		<published>2003-09-26T17:51:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=27611#p27611</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=27611#p27611"/>
		<title type="html"><![CDATA[Read/Write specific line]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=27611#p27611"><![CDATA[
How do i read a specific line from txt and or change it like i read line 5 and or i want to write to line 5 .. the reading i can do with counter and while but writing how would i do that ?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Fri Sep 26, 2003 5:51 pm</p><hr />
]]></content>
	</entry>
	</feed>
