I am using egrep to extract numbers from a file and storing them as variables in a script. But I am not able to do any arithmetic operations on the variables using "expr" because it stores them as char and not integers. Here is my code and the error I get. Any help will be appreciated.
#!/bin/sh
$x=`egrep "string" filename | grep -oE "[[:digit:]]{1,}"`
$y=`egrep "string" filename | grep -oE "[[:digit:]]{1,}"`
c=`expr $x + $y`
Error: expr: non-numeric argument