Adding numbers from the result of a grepThe problem there is your expression. with `totalErrors=${errors}+${totalErrors}, you're creating a string. You can do the same trick: echo both numbers as a list and use awk to sum them, or you can do it the bash way.

Adding numbers from the result of a grep@Amir You would use the first one like this variable=$(grep -o "[0-9] errors" verification_report_3.txt | awk '{ SUM += $1} END { print SUM }') This puts the output of the command (which is only the sum value) into the variable called variable

Query DHCP server leases from Perl scriptThis question is probably better on ServerFault since the question is mostly about how to extract the lease information from Windows. It has much less to do with the fact that you want to do it in Perl on a Linux box. In fact, I'd bet you need at least some code on the Windows box to do the extracting.