rssk 0 Junior Poster in Training

hi all....
i m writting a script using telnet session in linux............

first i want to read
1)read free message
2)process memory usage
3)%cpu usage
then using snmpwalk i want to repeat 1,2,3
after doing this i want to calculate difference before snmp walk and after snmp walk.......

i m not getting how to calculate difference.......
so plz me...............


thanks in advance