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

	<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>2005-05-10T17:40:42-04:00</updated>

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

		<entry>
		<author><name><![CDATA[^DooM^]]></name></author>
		<updated>2005-05-10T17:40:42-04:00</updated>

		<published>2005-05-10T17:40:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=49334#p49334</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=49334#p49334"/>
		<title type="html"><![CDATA[one more 'basic' question on this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=49334#p49334"><![CDATA[
This should of been asked in the Script Help section <span style="text-decoration:underline">NOT</span> the FAQ section. Please dont post your script help questions in this section.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3723">^DooM^</a> — Tue May 10, 2005 5:40 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[oioifatty]]></name></author>
		<updated>2005-05-10T17:21:50-04:00</updated>

		<published>2005-05-10T17:21:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=49331#p49331</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=49331#p49331"/>
		<title type="html"><![CDATA[another Question about file search]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=49331#p49331"><![CDATA[
Hi, i've got a smal tcl code that reads the contents of a file for devices, eth0, eth1 etc...<br>the devs file contains all of the items in the list, but it only returns the last item that matches in the dev file, i know its something to do with the IF's, but i just can't get my head arounfd the correct layout. could any suggest the correct layout?<br><div class="codebox"><p>Code: </p><pre><code>set devices "/devs"set file [ open $devices r ]set data [read -nonewline $file]    close $fileset lines [split $data "\n"]foreach line $lines {if [string match "*lo:*" $line] {set lo lo} else { set lo ""} if [string match -noc "*eth0:*" $line] {set eth0 eth0} else { set eth0 ""}if [string match -noc "*eth1:*" $line] {set eth1 eth1} else { set eth1 ""} if [string match -noc "*ppp0:*" $line] {set ppp0 ppp0} else { set ppp0 ""}if [string match -noc "*ppp1:*" $line] {set ppp1 ppp1} else { set ppp1 ""}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6210">oioifatty</a> — Tue May 10, 2005 5:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[greenbear]]></name></author>
		<updated>2005-05-10T14:26:01-04:00</updated>

		<published>2005-05-10T14:26:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=49322#p49322</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=49322#p49322"/>
		<title type="html"><![CDATA[one more 'basic' question on this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=49322#p49322"><![CDATA[
that doesnt direclty relate to this topic, so keep it out of the faq section.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=24">greenbear</a> — Tue May 10, 2005 2:26 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Thunderdome]]></name></author>
		<updated>2005-05-10T11:10:42-04:00</updated>

		<published>2005-05-10T11:10:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=49313#p49313</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=49313#p49313"/>
		<title type="html"><![CDATA[one more 'basic' question on this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=49313#p49313"><![CDATA[
GREAT WORK <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br>what about also some info on using eggHTTP.tcl to read "external" files?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6079">Thunderdome</a> — Tue May 10, 2005 11:10 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[oioifatty]]></name></author>
		<updated>2005-05-09T17:58:21-04:00</updated>

		<published>2005-05-09T17:58:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=49295#p49295</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=49295#p49295"/>
		<title type="html"><![CDATA[Thank you very much.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=49295#p49295"><![CDATA[
<span style="color:blue">Thank you for the response, it works a treat.</span><br><br><strong class="text-strong">p.s. sorry gb if i caused offence with the pm.</strong><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6210">oioifatty</a> — Mon May 09, 2005 5:58 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[greenbear]]></name></author>
		<updated>2005-05-09T17:41:38-04:00</updated>

		<published>2005-05-09T17:41:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=49293#p49293</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=49293#p49293"/>
		<title type="html"><![CDATA[one more 'basic' question on this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=49293#p49293"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set fname "/iptab"set fp [open $fname "r"]set data [read -nonewline $fp]close $fpset lines [split $data "\n"]set linenum 0foreach line $lines { if [string match -noc "*iptables -A OUTPUT -o \$internet -p tcp*" $line] {  set lines [lreplace $lines $linenum $linenum]  set fp [open $fname "w"]  puts $fp [join $lines "\n"]   close $fp } incr linenum}</code></pre></div>please don't send me any more private msg's.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=24">greenbear</a> — Mon May 09, 2005 5:41 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[oioifatty]]></name></author>
		<updated>2005-05-09T12:26:42-04:00</updated>

		<published>2005-05-09T12:26:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=49261#p49261</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=49261#p49261"/>
		<title type="html"><![CDATA[one more 'basic' question on this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=49261#p49261"><![CDATA[
<blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code>if [string match "iptables -A OUTPUT -o \$internet -p tcp" $line] { # it's a match, delete..</code></pre></div></div></blockquote>yeah thats the thing i want to acheive, but just don't know how to go about the deletion part. i've been using the examples of how to open a file, extract the text, and delete specified numbered lines. <br><br>but what about a specified string of text?<br>example of my code:<div class="codebox"><p>Code: </p><pre><code>set fname "/iptab"set fp [open $fname "r"]set data [read -nonewline $fp]close $fpforeach lines [split $data "\n"] {   if {[string match "iptables -A OUTPUT -o \$internet -p tcp" $line]} {   set line_to_delete $line}#so line_to_delete contains the string i want to delete, but where from here??}set fp [open $fname w]puts $fp [join $lines "\n"]close $fp } }</code></pre></div>Cheers,<br>Scott<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6210">oioifatty</a> — Mon May 09, 2005 12:26 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[greenbear]]></name></author>
		<updated>2005-05-09T10:14:23-04:00</updated>

		<published>2005-05-09T10:14:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=49259#p49259</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=49259#p49259"/>
		<title type="html"><![CDATA[one more 'basic' question on this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=49259#p49259"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>if [string match "iptables -A OUTPUT -o \$internet -p tcp" $line] { # it's a match, delete..</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=24">greenbear</a> — Mon May 09, 2005 10:14 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[oioifatty]]></name></author>
		<updated>2005-05-08T20:33:42-04:00</updated>

		<published>2005-05-08T20:33:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=49232#p49232</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=49232#p49232"/>
		<title type="html"><![CDATA[one more 'basic' question on this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=49232#p49232"><![CDATA[
sorry that was proberly a bit vague,<br>############################<br>#this is the check button command#<br>############################<br>if {$http == 1}    {<br>    set a [open /iptab a+]<br>puts $a "iptables -A OUTPUT -o \$internet -p tcp"  &lt;--Inputs iptables command into file<br>close $a<br>} else {<br>#########################################<br># this is the bit where i'd like the pattern matching #<br>#########################################<br>so, for example if "iptables -A OUTPUT -o $internet -p tcp" existed in the file, i'd like to remove it from the file.<br>so, basically selecting the tick box turns a feature on, deselecting it turns it off<br>}<br><br>Sorry if its a particulary difficult post to answer<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6210">oioifatty</a> — Sun May 08, 2005 8:33 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[oioifatty]]></name></author>
		<updated>2005-05-08T20:05:55-04:00</updated>

		<published>2005-05-08T20:05:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=49230#p49230</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=49230#p49230"/>
		<title type="html"><![CDATA[pattern matching and deleting.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=49230#p49230"><![CDATA[
Just like to state this is a really great forum, actually the most imformative i've been on, btw not brown nosing. lol<br><br>To my question:<br><br>I am attempting to write a TCL/TK firewall gui on my fedora core box, just having bit of a problem with deleting strings from a file, I want to pattern match a string, and if it exists in a particular file i would like to delete it. I understand how to delete lines from a file (from the examples above), but just don't know how to go about matching a string and removing it. any help would be very appreciated.<br><br>Cheers to anyone who responds.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6210">oioifatty</a> — Sun May 08, 2005 8:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arcane]]></name></author>
		<updated>2004-12-26T08:28:53-04:00</updated>

		<published>2004-12-26T08:28:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=44522#p44522</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=44522#p44522"/>
		<title type="html"><![CDATA[one more 'basic' question on this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=44522#p44522"><![CDATA[
just don't split on " " <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2617">arcane</a> — Sun Dec 26, 2004 8:28 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[[Zod]]]></name></author>
		<updated>2004-12-26T04:08:26-04:00</updated>

		<published>2004-12-26T04:08:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=44516#p44516</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=44516#p44516"/>
		<title type="html"><![CDATA[one more 'basic' question on this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=44516#p44516"><![CDATA[
How do you read from a file into a list, but allow strings with spaces to be on one line?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5831">[Zod]</a> — Sun Dec 26, 2004 4:08 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arcane]]></name></author>
		<updated>2004-08-17T08:19:29-04:00</updated>

		<published>2004-08-17T08:19:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39865#p39865</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39865#p39865"/>
		<title type="html"><![CDATA[one more 'basic' question on this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39865#p39865"><![CDATA[
well, just drop the "foreach" part and use lindex on [split $data \n] <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>e.g. for line 13:<div class="codebox"><p>Code: </p><pre><code>bind pub - .test pub:test proc pub:test { nick uhost handle channel arg } {    global testurl    set url $testurl    set file scripts/test.txt    exec lynx -preparsed -nolist -dump -width=5000 $url &gt; $file    set textf [open $file r]    set data [split [read $textf] \n]    set text [lindex $data 12]    putserv "PRIVMSG $c :$text"    catch {close $file} } </code></pre></div>always use "lindex &lt;yournumber&gt;-1" because the first line is index 0<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2617">arcane</a> — Tue Aug 17, 2004 8:19 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[NewzUK]]></name></author>
		<updated>2004-08-17T02:44:02-04:00</updated>

		<published>2004-08-17T02:44:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39858#p39858</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39858#p39858"/>
		<title type="html"><![CDATA[one more 'basic' question on this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39858#p39858"><![CDATA[
Hi - one more 'basic' question on this (I've searched the forums but still havn't got it) - how would you go about reading a specific line number (as there's nothing unique in the text I can identify it with) <br>eg here's the script but using a string match, but instead, I want to get line number 13...<br><div class="codebox"><p>Code: </p><pre><code>bind pub - .test pub:testproc pub:test { nick uhost handle channel arg } {global testurlset url $testurlset file scripts/test.txtexec lynx -preparsed -nolist -dump -width=5000 $url &gt; $fileset textf [open $file r] set data [read $textf]foreach line [split $data \n] {if {[string match *word* $line]} {set text $lineputserv "PRIVMSG $c :$text" }}catch {close $file}}</code></pre></div>appreciate in advance any help!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2210">NewzUK</a> — Tue Aug 17, 2004 2:44 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[netux]]></name></author>
		<updated>2004-07-31T07:45:15-04:00</updated>

		<published>2004-07-31T07:45:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39286#p39286</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39286#p39286"/>
		<title type="html"><![CDATA[one more 'basic' question on this]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39286#p39286"><![CDATA[
i, nice place <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><br>could you extend your explanation with:<br><br>-add/replace/del a midle line (special replace)<br>-replace a word in a line (let's say file as 3 lines and you want to change second word of second line)<br>-read a specific word on a line (could be same as abose 2 of 2)<br>tks extend this faq and make a guide/tutorial hould be great, nice and simple explenations here.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5272">netux</a> — Sat Jul 31, 2004 7:45 am</p><hr />
]]></content>
	</entry>
	</feed>
