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

	<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>2012-04-03T03:20:19-04:00</updated>

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

		<entry>
		<author><name><![CDATA[username]]></name></author>
		<updated>2012-04-03T03:20:19-04:00</updated>

		<published>2012-04-03T03:20:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99157#p99157</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99157#p99157"/>
		<title type="html"><![CDATA[REQUEST: Search log file(s) for string]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99157#p99157"><![CDATA[
Try my script. This is the early alpha version. But it can find last line with needed text. And it can ignore lines from bots.<br>Ive add some comments to code. If you have some suggestions, Ill be glad to read them.<br> <div class="codebox"><p>Code: </p><pre><code># List of bots to ignore.set ignorenicks "lamestbot quiz Info bionic"bind pub n|n !ls lsproc ls {nick uhost hand chan text} {global ignorenicks    # We get the folder with channel logs    regexp {\#(.*?)$} $chan "" channel    #set channel "egghelp"    # String to search    set string $text    # All logfiles in channel log folder    set alllogs [glob -directory "logs/$channel" -types f -nocomplain "*"]    set mtimelist [list]    # We create new list with log filenames and modify time    foreach log $alllogs {        lappend mtimelist [list $log [file mtime $log]]    }    # We sort logs by modify time    set sortmtimelist [lsort -decreasing -index 1 "$mtimelist"]    # And create new list with ligfiles only. They sorted by modify time.    foreach sortlog $sortmtimelist {        lappend sortlogs [lindex $sortlog 0]    }    # We begin work with every logfile.    foreach logfile $sortlogs {        set file [open "$logfile" "r"]        # We reverse logfile because we need to get the latest result at first.        # I need to rewrite this part useing lreverse command.        set data [read -nonewline $file]        close $file        set lines [split $data "\n"]        set lines_ [list]        foreach line $lines {            set lines_ [linsert $lines_ 0 $line]        }        set file [open "reverselog" "w+"]        puts $file [join $lines_ "\n"]        close $file                        # Here we collect all lines with needed string in searchedlines variable.        foreach line [split [read [open "reverselog" "r"]] "\n"] {            if {[regexp {\&lt;.*?\&gt;\ (.*?)$} $line "" line2]} {                if {[string match -nocase "*$string*" $line2]} {                    lappend searchedlines $line                }            }        }        close $file        file delete -force "reverselog"    }    # we take our lines and push them to other proc.    if {[info exists searchedlines] &amp;&amp; $searchedlines != ""} {        workwithlines $nick $uhost $hand $chan $searchedlines    } else {        putserv "PRIVMSG $chan :There is no \'$string\' in \#$channel logs."        return 0    }    }# In this proc we delete lines from ignored bots. And send the firsh found line to channel.proc workwithlines {nick uhost hand chan searchedlines} {    foreach searchedline $searchedlines {                regexp {\&lt;(.*?)\&gt;} $searchedline "" nickname               if {[checkignorenick $nickname] == "0"} {            lappend neededlines $searchedline        }                   }putserv "PRIVMSG $chan :[lindex $neededlines 0]"putlog [llength $neededlines]}# Here we check the author of line.proc checkignorenick {nick} {global ignorenicks      foreach ignorenick $ignorenicks {        if {$ignorenick == $nick} {            return 1        }    }        return 0}putlog "Log Search by tvrsh v0.1 loaded ..."</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6813">username</a> — Tue Apr 03, 2012 3:20 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Scayett]]></name></author>
		<updated>2012-03-29T12:11:48-04:00</updated>

		<published>2012-03-29T12:11:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99141#p99141</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99141#p99141"/>
		<title type="html"><![CDATA[REQUEST: Search log file(s) for string]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99141#p99141"><![CDATA[
Hi,<br><br>I was thinking for a while and thought of a script idea, one that users can use to search a string with a command inside the bot's latest log file, and return the latest message with that, however it does not include the bot's text.<br><br>For example:<br><blockquote class="uncited"><div>User: hello there<br>Tom: hiya, User!<br>User: !log hiya<br>Bot: User: &lt;Tom&gt; hiya, User! @ 3:00 AM 29/03/12<br>Tom: hmm<br>Tom: !log User<br>Bot: Tom: &lt;User&gt; !log hiya</div></blockquote>Is something like this do-able?<br><br>Thanks.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11952">Scayett</a> — Thu Mar 29, 2012 12:11 pm</p><hr />
]]></content>
	</entry>
	</feed>
