while read -r num; do ((sum += num)); done < inputfile; echo $sum
from : https://stackoverflow.com/questions/3096259/bash-command-to-sum-a-column-of-numbers
while read -r num; do ((sum += num)); done < inputfile; echo $sum
In case if you want to check whether file does not contain a specific string, you can do it as follows. if ! grep -q SomeString "$File...
No comments:
Post a Comment