<?xml version="1.0" encoding="windows-1252"?>
<node id="1017891" title="Re: perl onliner on multiple files" created="2013-02-08 16:30:40" updated="2013-02-08 16:30:40">
<type id="11">
note</type>
<author id="646155">
igelkott</author>
<data>
<field name="doctext">
&lt;p&gt;Seems to work fine (on a reasonable number of files) if you want the total sum. If you want the sum per file, a minimal change would be to print and reset $c after each file ends.&lt;/p&gt;
For example:
&lt;c&gt;
perl -e ' while (&lt;&gt;) { if (/: /) {  $c += (split /: /)[0]; } 
    if(eof) { print "SUM.$ARGV =$c\n"; $c=0; } }' tmp_*
&lt;/c&gt;</field>
<field name="root_node">
1017880</field>
<field name="parent_node">
1017880</field>
</data>
</node>
