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

	<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>2014-06-25T13:05:17-04:00</updated>

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

		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2014-06-25T13:05:17-04:00</updated>

		<published>2014-06-25T13:05:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=102933#p102933</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=102933#p102933"/>
		<title type="html"><![CDATA[Open File, Search for Text, Output Text]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=102933#p102933"><![CDATA[
Actually there is a backport of the Tcl 8.5 [dict] command for Tcl 8.4 that can be found at <a href="https://github.com/noyesno/Tcl-Dict" class="postlink">https://github.com/noyesno/Tcl-Dict</a><br><br>To be honest, haven't tried it as I always update to the latest versions.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Wed Jun 25, 2014 1:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[InTeNsO]]></name></author>
		<updated>2014-06-24T17:19:57-04:00</updated>

		<published>2014-06-24T17:19:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=102931#p102931</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=102931#p102931"/>
		<title type="html"><![CDATA[Open File, Search for Text, Output Text]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=102931#p102931"><![CDATA[
Well the problem is, the eggdrop is only on 8.4... so no support with dict.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10646">InTeNsO</a> — Tue Jun 24, 2014 5:19 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2014-06-23T07:36:52-04:00</updated>

		<published>2014-06-23T07:36:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=102923#p102923</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=102923#p102923"/>
		<title type="html"><![CDATA[Open File, Search for Text, Output Text]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=102923#p102923"><![CDATA[
Hi,<br><br>If the file you want to read is in JSON format why don't you use json::json2dict to transform it in a dictionary and then use <a href="http://www.tcl.tk/man/tcl8.6/TclCmd/dict.htm" class="postlink">dict</a>'s functions to fetch what info you want?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Mon Jun 23, 2014 7:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[InTeNsO]]></name></author>
		<updated>2014-06-23T04:57:19-04:00</updated>

		<published>2014-06-23T04:57:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=102922#p102922</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=102922#p102922"/>
		<title type="html"><![CDATA[Open File, Search for Text, Output Text]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=102922#p102922"><![CDATA[
I want to search for a line in a file and then output the complete line or parts of it.<br><br>The file looks like this. <a href="http://hearthstonejson.com/json/AllSets.enUS.json" class="postlink">http://hearthstonejson.com/json/AllSets.enUS.json</a><div class="codebox"><p>Code: </p><pre><code>,{"id":"EX1_116","name":"Leeroy Jenkins","type":"Minion","faction":"Alliance","rarity":"Legendary","cost":4,"attack":6,"health":2,"text":"&lt;b&gt;Charge&lt;/b&gt;. &lt;b&gt;Battlecry:&lt;/b&gt; Summon two 1/1 Whelps for your opponent.","flavor":"At least he has Angry Chicken.","artist":"Gabe from Penny Arcade","collectible":true,"elite":true,"mechanics":["Battlecry","Charge"]},{"id":"EX1_029","name":"Leper Gnome","type":"Minion","faction":"Neutral","rarity":"Common","cost":1,"attack":2,"health":1,"text":"&lt;b&gt;Deathrattle:&lt;/b&gt; Deal 2 damage to the enemy hero.","flavor":"He really just wants to be your friend, but the constant rejection is starting to really get to him.","artist":"Glenn Rane","collectible":true,"mechanics":["Deathrattle"]},</code></pre></div> <br><div class="codebox"><p>Code: </p><pre><code>putlog "\[\0032hscard.tcl\003\] loaded"bind pub - !hs hscard# !hs leeroyproc hscard {nick uhost hand chan hscard} {  if {$hscard == ""} { putserv "NOTICE $nick :!hs card" ;return 0 }    set fd [open "scripts/cards.json" r]    set cont [read $fd]    close $fd    foreach line [split $cont "\n"] {       if {[string match -nocase "*$hscard*" $line]} {   #regexp {.*?\"name\":\"$hscard\",(.*?)} $line - hs(name)  #putlog "$hs(name)"         putserv "PRIVMSG $chan :'$hscard' is in the file!"          set found 1  ;  break       }    }    if {![info exists found]} {       putserv "PRIVMSG $chan :Text is not found.."    } } </code></pre></div>The Output should be somethins like this. <br>&lt;bot&gt; [Leeroy Jenkins]: 6/2: Cost: 4 - Usable by all classes - Charge. Battlecry: Summon two 1/1 Whelps for your opponent.[/code]<br><br>I don't know how to regexp/lsearch or whatever to read that one complete line that contains what i need.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10646">InTeNsO</a> — Mon Jun 23, 2014 4:57 am</p><hr />
]]></content>
	</entry>
	</feed>
