awk sum numbers after a separator -


i need simple awk calculate sum of number @ end of file looks this:

/z02/abcd/stuff/abc_def_02/count/abc_def_02_abcde66.log.20120605_101201_015.log.gz:28 /z02/abcd/stuff/abc_def_02/count/abc_def_02_abcde66.log.20120605_101202_015.log.gz:28 /z02/abcd/stuff/abc_def_02/count/abc_def_02_abcde66.log.20120605_101203_015.log.gz:28 /z02/abcd/stuff/abc_def_02/count/abc_def_02_abcde66.log.20120605_101204_015.log.gz:28 

so numbers after ":" need added together

echo "....." | awk '-f:' '{total+=$nf}end{print "sumtotal=" total}'  

you can, of course, leave out "sumtotal=" part, depending on needs.

i hope helps.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -