How to add all values in a certain column?
<p>I want to add all the 3rd fields from each line and produce the result.</p>

<p>Below is the way I solved the problem</p>

<pre><code>sum=0
grep '2016Feb' input.txt|awk -F\- '{print $3}'|while read LINE; do
sum = $(expr $sum + $LINE)
done
echo $sum
</code></pre>

<p>Is there a better way of solving the problem than my code? Possible a command that solves the problem @ command line itself?</p>

<p>For a file like:</p>

<pre><code>$ cat input.txt
Feb2016-2016-110
Feb2016-2016-20
Feb2016-2016-220
Feb2016-2016-140
Feb2016-2016-100
</code></pre>

<p>The output is: <code>590</code>.</p>