awk with arguments

Hi
I have a file which looks like this:

$ cat my_file
f1acc: 1398
f1pdb: 495
f1trn: 1288
f1txn: 7326
t1trn: 8241
t1txn: 8292
p080$

I am trying to "egrep" a certain pattern from this file and put a value of a variable in front of each line, for example:

pnum=555
cat my_file | egrep 'pdb|acc' | nawk -v v=$pnum '{print $v FS $1 FS $2}'

I hoped the output would be as follows:
555 f1acc: 1398
555 f1pdb: 495

But the actual output from the above command is

p080$ cat my_file | egrep 'pdb|acc' | nawk -v v=$pnum '{print $v FS $1 FS $2}'
f1acc: f1acc: 1398
f1pdb: f1pdb: 495

Please help. Thanks a lot -A

use one code only as below:-

nawk -F":" -v v=$pnum '/pdb|acc/{print v " " $1 FS $2}'  file.txt

:D:D:D

GNU sed:

sed -n "/acc\|pdb/s/^/$pnum /p" file.txt

to print the value of a set variable just use the variable name, no need to add the "$"

{print v

Or:

awk -v n=$pnum '/pdb|acc/{print n FS $0}' file
awk '/pdb|acc/{print p,$0}' p=$pnum file