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

	<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-02-26T12:43:42-04:00</updated>

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

		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-02-26T12:43:42-04:00</updated>

		<published>2003-02-26T12:43:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=17102#p17102</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=17102#p17102"/>
		<title type="html"><![CDATA[sugestion]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=17102#p17102"><![CDATA[
A lil typo mistake:<div class="codebox"><p>Code: </p><pre><code>se fp [open $out w] </code></pre></div>should be:<div class="codebox"><p>Code: </p><pre><code>set fp [open $out w] </code></pre></div>And seems to be working fine. Thank you.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Wed Feb 26, 2003 12:43 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-02-26T08:29:17-04:00</updated>

		<published>2003-02-26T08:29:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=17086#p17086</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=17086#p17086"/>
		<title type="html"><![CDATA[sugestion]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=17086#p17086"><![CDATA[
Having got more tiem to work on it now, though I still havn't tested it, there are a few major changes.<br><div class="codebox"><p>Code: </p><pre><code>#!/usr/bin/tclshproc out {text} {  puts stdout $text}proc usage {} {  global argv0  out "Usage: $argv0 \[InputFile\] \[OutputFile\] &lt;MaxLen&gt;"  out "\[InputFile\] : File to filter for duplicate or long entries"  out "\[OuputFile\] : File to create with filtered output"  out "&lt;MaxLen&gt; : If lines should be a maximum length, specify the limit here (optional). 0 or not given disables this"  exit}if {$argc &lt; 2} { usage }set in [lindex $argv 0]set out [lindex $argv 1]set max 0if {$argc &gt;= 3} { set max [lindex $argv 2] }if {[regexp -- {[^0-9]} $max]} {  out "Invalid max length given"  usage}if {(![file exists $in]) || ([file exists $out])} {  out "Input file doesn't exist, or output is allready there"  usage}set fp [open $in r]set buf [split [read $fp] \n]set outbuf [list]close $fpout "Scanning file"set idx 1foreach line $buf {  if {[lsearch -exact [lrange $buf $idx end] $line] &gt;= 0} {    incr idx    continue  }  if {($max) &amp;&amp; ([string length $line] &gt; $max)} {    incr idx    continue  }  lappend outbuf $line  incr idx}out "Writting output buffer"se fp [open $out w]foreach a $outbuf {  puts $fp $a}close $fpout "Output complete. Discarded [expr [llength $buf] - [llength $outbuf]] record(s)"</code></pre></div>I had a nasty brain fart, and I think I am getting the flu (I feel rotton, and the rest of the family claims they are ill).<br><br>I had made major "Just woekn" spelling errors and forgot to create a list out of the incoming text.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Wed Feb 26, 2003 8:29 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-02-26T08:18:33-04:00</updated>

		<published>2003-02-26T08:18:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=17085#p17085</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=17085#p17085"/>
		<title type="html"><![CDATA[sugestion]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=17085#p17085"><![CDATA[
Also, I've noticed that it stops when encounters in the *in* file a ';', a '?' and I guess there is more..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Wed Feb 26, 2003 8:18 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-02-26T08:14:50-04:00</updated>

		<published>2003-02-26T08:14:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=17084#p17084</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=17084#p17084"/>
		<title type="html"><![CDATA[sugestion]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=17084#p17084"><![CDATA[
I've located the *exists* and seems to be corectly. I've also uncomented them and got another error:<br><div class="codebox"><p>Code: </p><pre><code>[irc@delta irc]$ tclsh sort.tcl trivia.wri result.wri 0Scanning filelist element in quotes followed by ";" instead of space    while executing"foreach line $buf { if {[lsearch -exact [lrange $buf $idx end] $line] &gt;= 0} { incr idx continue } if {($max) &amp;&amp; ([string length $line] &gt; $max)} {..."    (file "sort.tcl" line 39)</code></pre></div>Also I've noticed a lil typing mistake:<div class="codebox"><p>Code: </p><pre><code>se fp [oepn $out w]</code></pre></div>should be:<div class="codebox"><p>Code: </p><pre><code>set fp [open $out w]</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Wed Feb 26, 2003 8:14 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-02-26T08:02:14-04:00</updated>

		<published>2003-02-26T08:02:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=17083#p17083</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=17083#p17083"/>
		<title type="html"><![CDATA[sugestion]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=17083#p17083"><![CDATA[
Hi, Thank you for your kind help on this. I've bumped in a problem:<br><div class="codebox"><p>Code: </p><pre><code>[irc@delta irc]$ tclsh sort.tcl trivia.wri result.wri 0bad option "exits": must be atime, attributes, channels, copy, delete, dirname, executable, exists, extension, isdirectory, isfile, join, lstat, mtime, mkdir, nativename, owned, pathtype, readable, readlink, rename, rootname, size, split, stat, tail, type, volumes, or writable    while executing"file exits $in"    (file "sort.tcl" line 1)</code></pre></div>I'll look imediatly after the error.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Wed Feb 26, 2003 8:02 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-02-26T05:55:57-04:00</updated>

		<published>2003-02-26T05:55:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=17080#p17080</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=17080#p17080"/>
		<title type="html"><![CDATA[sugestion]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=17080#p17080"><![CDATA[
This is a small Tcl application. It doesn't work on eggdrop, as it's designed for the command line.<br><div class="codebox"><p>Code: </p><pre><code>#!/usr/bin/tclshproc out {text} {  puts stdout $text}proc usage {} {  global argv0  out "Usage: $argv0 \[InputFile\] \[OutputFile\] &lt;MaxLen&gt;"  out "\[InputFile\] : File to filter for duplicate or long entries"  out "\[OuputFile\] : File to create with filtered output"  out "&lt;MaxLen&gt; : If lines should be a maximum length, specify the limit here (optional). 0 or not given disables this"  exit}if {$argc &lt; 2} { usage }set in [lindex $argv 0]set out [lindex $argv 1]set max 0if {$argc &gt;= 3} { set max [lindex $argv 2] }if {[regexp -- {[^0-9]} $max]} {  out "Invalid max length given"  usage}if {(![file exits $in]) || ([file exists $out])} {  out "Input file doesn't exist, or output is allready there"  usage}set fp [open $in r]set buf [read $fp]set outbuf [list]close $fpout "Scanning file"set idx 1foreach line $buf {  if {[lsearch -exact [lrange $buf $idx end] $line] &gt;= 0} {    incr idx    continue  }  if {($max) &amp;&amp; ([string length $line] &gt; $max)} {    incr idx    continue  }  lappend outbuf $line  incr idx}out "Writting output buffer"se fp [oepn $out w]foreach a $outbuf {  puts $fp $a}close $fpout "Output complete. Discarded [expr [llength $buf] - [llength $outbuf]] record(s)"</code></pre></div>If this works, and the speed of it is another matter.<br><br>However, there is one small issue. It doesn't account for different letter cases in duplicates.<br><br>IE<blockquote class="uncited"><div>This is a test by PPSlim!<br>This is a test by ppslim!</div></blockquote>The above two are different.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Wed Feb 26, 2003 5:55 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arcane]]></name></author>
		<updated>2003-02-26T05:25:36-04:00</updated>

		<published>2003-02-26T05:25:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=17078#p17078</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=17078#p17078"/>
		<title type="html"><![CDATA[sugestion]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=17078#p17078"><![CDATA[
for clone-detection:<br>i think it saves time, if you first sort the lines and then check only the next...<br>c++: if youre interested in a win-app i could help you.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2617">arcane</a> — Wed Feb 26, 2003 5:25 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2003-02-25T20:30:35-04:00</updated>

		<published>2003-02-25T20:30:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=17071#p17071</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=17071#p17071"/>
		<title type="html"><![CDATA[hmmm]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=17071#p17071"><![CDATA[
if the whole thing is read in a table, you would only have to make 2 foreach and check each line against each other. this could take a while, but its a onetime srcipt, so who cares? <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile">. for the length... isnt there a linelength count command!? just include this check ^-^.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2382">De Kus</a> — Tue Feb 25, 2003 8:30 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-02-25T14:25:37-04:00</updated>

		<published>2003-02-25T14:25:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=17062#p17062</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=17062#p17062"/>
		<title type="html"><![CDATA[sugestion]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=17062#p17062"><![CDATA[
Heh, good for you. I don't now C* at all <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=187">caesar</a> — Tue Feb 25, 2003 2:25 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arcane]]></name></author>
		<updated>2003-02-25T11:19:02-04:00</updated>

		<published>2003-02-25T11:19:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=17058#p17058</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=17058#p17058"/>
		<title type="html"><![CDATA[sugestion]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=17058#p17058"><![CDATA[
hehe... i would write me some short c++ program to do this for me <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2617">arcane</a> — Tue Feb 25, 2003 11:19 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-02-25T08:35:10-04:00</updated>

		<published>2003-02-25T08:35:10-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=17056#p17056</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=17056#p17056"/>
		<title type="html"><![CDATA[sugestion]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=17056#p17056"><![CDATA[
Hi,<br>I'm going to put some trivia on a channel and I have about 11000 questions in a file. Some of them are repeated and I want to remove the *clones* and leave only one. Also, for the to long questions to be removed. Any ideeas? I was thinking to get the *line* length and remove it if it's bigger than *x*, or something like this..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Tue Feb 25, 2003 8:35 am</p><hr />
]]></content>
	</entry>
	</feed>
