Thursday, 16 July 2020

Bash command to sum a column of numbers

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

No comments:

Post a Comment

How to check if a file contains a specific string using Bash

 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...