Bash: How to Calculate Sum After Reading File

Here is a shell script to calculate the sum of input file records. And to replace a string with a new one using sed utility.