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

	<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>2009-01-07T23:50:19-04:00</updated>

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

		<entry>
		<author><name><![CDATA[incith]]></name></author>
		<updated>2009-01-07T23:50:19-04:00</updated>

		<published>2009-01-07T23:50:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=86784#p86784</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=86784#p86784"/>
		<title type="html"><![CDATA[Grep Count Feature (Somewhat related to eggdrop)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=86784#p86784"><![CDATA[
Er well I guess I should have posted a solution for you.<br><br>Yes, perl is one choice, although it will not be cross platform.<br><br>In Tcl..:<div class="codebox"><p>Code: </p><pre><code>% set confd [open eggdrop/visitant.conf]file3% while {![eof $confd]} {  append conf [gets $confd]}% regexp "{" $conf1% regexp -all "{" $conf12% regexp -all "}" $conf12</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6130">incith</a> — Wed Jan 07, 2009 11:50 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Vexor]]></name></author>
		<updated>2009-01-07T09:29:53-04:00</updated>

		<published>2009-01-07T09:29:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=86771#p86771</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=86771#p86771"/>
		<title type="html"><![CDATA[Grep Count Feature (Somewhat related to eggdrop)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=86771#p86771"><![CDATA[
Ah I see.  Confirmed in a test file.<br><br>Is there any way to make grep count the actual times a { or } appears in a file?  It's been over a year since I've even touched a linux command.<br><br>*EDIT*<br>Ah, with a little bit of help from my old pal google, I came across this:<br><br><a href="http://codesnippets.joyent.com/tag/count" class="postlink">http://codesnippets.joyent.com/tag/count</a><br><br>perl -lne '$c++ while /STRING_TO_COUNT/g; END { print $c; }'<br><br>Example: cat eggdrop.conf | perl -lne '$c++ while /}/g; END { print $c; }'<br>Result: 16<br>               cat eggdrop.conf | perl -lne '$c++ while /{/g; END { print $c; }'<br>           16<br><br>So for anyone out there who's missing a " or {} [] etc...<br>cat filename | perl -lne '$c++ while /WHAT_YOURE_COUNTING_FOR/g; END { print $c; }'<br><br>*FURTHER EDIT*<br><br>Here is a simple bash script you can put in place to do this from one command:<div class="codebox"><p>Code: </p><pre><code>#!/bin/bashcat $1 | perl -lne '$c++ while /'$2'/g; END { print $c; }'</code></pre></div>Example: count test {<br><br>Just pop that into a file aptly named (I used count) and place in your /bin.  Of course don't forget to chmod!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7993">Vexor</a> — Wed Jan 07, 2009 9:29 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[incith]]></name></author>
		<updated>2009-01-06T23:03:13-04:00</updated>

		<published>2009-01-06T23:03:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=86755#p86755</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=86755#p86755"/>
		<title type="html"><![CDATA[Grep Count Feature (Somewhat related to eggdrop)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=86755#p86755"><![CDATA[
Ah I understand, it's counting the number of line-matches the way I see it, not character matches.  } is on 12 lines whereas { is on 11 lines.<br><blockquote class="uncited"><div>proc evnt:init_server {type} {</div></blockquote><blockquote class="uncited"><div>$ grep '{' visitant.conf<br>set altnick "${nick}-??"<br>set username "${nick}"<br>set botnet-nick "${nick}"<br>set notefile "${nick}.notes"<br>set userfile "${nick}.user"<br>set pidfile "${nick}.pid"<br>set chanfile "${nick}.chan"<br>set global-chanset {<br>proc evnt:init_server {type} {<br>  putserv {}<br>set servers {</div></blockquote><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6130">incith</a> — Tue Jan 06, 2009 11:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[incith]]></name></author>
		<updated>2009-01-06T23:02:03-04:00</updated>

		<published>2009-01-06T23:02:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=86754#p86754</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=86754#p86754"/>
		<title type="html"><![CDATA[Grep Count Feature (Somewhat related to eggdrop)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=86754#p86754"><![CDATA[
Interesting.<br>From a shell,<blockquote class="uncited"><div>$ grep -c '{' visitant.conf<br>11</div></blockquote>But there are actually 12 { in my conf file...  Tcl would complain I'm sure if they didn't actually match up.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6130">incith</a> — Tue Jan 06, 2009 11:02 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Vexor]]></name></author>
		<updated>2009-01-06T21:21:12-04:00</updated>

		<published>2009-01-06T21:21:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=86753#p86753</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=86753#p86753"/>
		<title type="html"><![CDATA[Grep Count Feature (Somewhat related to eggdrop)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=86753#p86753"><![CDATA[
Hey guys, I was playing around with grep earlier and was doing some bracket counting and came across this odd little quirk.<br><br>[squib@amish eggdrop]$ grep -c '{' eggdrop.conf<br>15<br>[squib@amish eggdrop]$ grep -c '}' eggdrop.conf<br>16<br><br>Now I have gone through and manually counted the brackets in eggdrop.conf, they match up.  The eggdrop doesn't send out any errors and in fact runs smoothly.<br><br>So I'm just wondering, is this a bug with grep or is there something I'm completely missing?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7993">Vexor</a> — Tue Jan 06, 2009 9:21 pm</p><hr />
]]></content>
	</entry>
	</feed>
