Display Additional Variable string in awk print command

Hi all,
I have script to monitor and sum up the total memory use up for each individual process.

proc=$1
svmon -P -O summary=basic,unit=MB|awk 'NR>4'|grep -w "${proc}" |awk '{sum+=$3} END {printf "\t" sum """\n";}'

But I would like the script to be able to display as following

Execute
------

 ./script java

Output
-----

  java -> 1233

Can anyone has bright idea on this ?

Thanks.

Please use code tags

... | awk '{sum+=$3} END {printf pname"->" sum "\n";}' pname=$proc

--ahamed

---------- Post updated at 01:08 AM ---------- Previous update was at 01:01 AM ----------

See if this helps to reduce the code

proc=$1
svmon -P -O summary=basic,unit=MB | awk '/'$proc'/&&NR>4{sum+=$3} END {printf pname"->" sum "\n";}' pname=$proc

--ahamed

thanks Ahamed, yes this is working. And thanks for instant reply.

---------- Post updated at 07:56 PM ---------- Previous update was at 03:32 AM ----------

Hi Ahmed, just realize that the sum of one of the process call "sh" in fact, it sum out together the rest of the "ksh", "ksh" etc of Inuse values. Could you just match exact string in awk comparison ? thanks

If you can provide the output of svmon... , then we can try to do a column match, else we need to traverse the entire line for a exact match field by field check.

--ahamed