updating a column in a unix table for a particular row

Hi,
I have the following requirement.
I have a unix table as below

progname par1 par2 par3 par4
PROG1 abc def 0012 ooo
PROG2 wed xas 0100 xxx
PROG3 kkk ppp 0004 ppp

Different programs(ex:PROG1,PROG2..) accesses this table and update par3, corresponding to this progname... (i.e, when PROG1 is running, it updates it's corresponding par3 to 0013, similarly for other programs).. How can I achive this updation of par3 column for a particular row corresponding to that program thru shell scripting in a easy way)

After program PROG1 runs, the above table should look like
progname par1 par2 par3 par4
PROG1 abc def 0013 ooo
PROG2 wed xas 0100 xxx
PROG3 kkk ppp 0004 ppp

if PROG3 runs later then the table should look like
progname par1 par2 par3 par4
PROG1 abc def 0013 ooo
PROG2 wed xas 0100 xxx
PROG3 kkk ppp 0005 ppp

Can someone helpme out how this file column updation for a particular row can be achieved easily thru shell scripting.
Thanks for any of your inputs...

Try...

awk '$1==p{$4=sprintf("%04d",$4+1)};1' p=PROG2 file1 > file2

Iam getting below syntax error ( Using Sunsolaris)

awk '$1==p{$4=sprintf("%04d",$4+1)};1' p=PROG2 table > table1
awk: syntax error near line 1
awk: bailing out near line 1

Something to be changed in the command...

Replace awk with nawk.

Cheers
ZB

nawk '$1==p{$4=sprintf("%04d",$4+1)};1' p=PROG2 table > table
Hi if I use the command like above, the table is erased totally

nawk '$1==p{$4=sprintf("%04d",$4+1)};1' p=PROG2 table > table1
it writes into a new table table1.. then I need to overwrite table1 with table

But if two programs are running simultaneourly, I don't know, if this works fine.

In general it's a bad idea to redirect the output of a filter (unix command) to the input as it usually results in and empty file.