UNIX tips for the day
1. How do you sum up a file containing numbers (one in each row)?
I keep forgetting there is a simple AWK command to do this...
[paddu@home ] cat <filename.txt> | awk '{sum = sum + $1}; END {print sum}'
I keep forgetting there is a simple AWK command to do this...
[paddu@home ] cat <filename.txt> | awk '{sum = sum + $1}; END {print sum}'
Labels: Geeks are sexy
2 Comments:
one of the best series of all times...
sorry, wanted to comment on the Yes Minister post
Post a Comment
<< Home