It's been about 10 years since I've done bash scripting, but this should work. If someone has a better way, I'd love to know it since this seems pretty crude to me.
Code:
i=1;
i=`expr $i + 1`;
echo $i;
That code will print "2" when you run it. And by the way, those single quotes are the ones on the tilde key (~), not on the double-quote key ("). Then again, if you've already figured out sed and awk, you probably knew that...
By the way, it also works just the same if the first line is a string; the conversion should be automatic.