column renumbering

Hi,
I am a beginner in awk scripting! I need your help; I want to replace the fifth column number (which is 15 here) here in this file for example :

ATOM 142 N PRO A 15
ATOM 143 CD PRO A 15
ATOM 144 HD1 PRO A 15
ATOM 145 HD2 PRO A 15
ATOM 146 CA PRO A 15
ATOM 147 HA PRO A 15
ATOM 148 CB PRO A 15
ATOM 149 HB1 PRO A 15

with sequential numbering :

ATOM 142 N PRO A 1
ATOM 143 CD PRO A 2
ATOM 144 HD1 PRO A 3
ATOM 145 HD2 PRO A 4
ATOM 146 CA PRO A 5
ATOM 147 HA PRO A 6
ATOM 148 CB PRO A 7
ATOM 149 HB1 PRO A 8
with an awk shell script... I guess this is too simple a question!! but I would appreciate any suggestions from you...:confused:
thanks already.

 awk '{$NF=NR}{print}' file

Regards

Thanks a lot for your quick reply, but what if I want to replace this sequential numbers with an existing column? because this is not the last column of my file, this is the 6th column which I want to renumber sequentially...
if you could help me again, I will be more than thankful...

Can you show a sample of the input and output.

Replace $NF by your column number :

awk '{$2=NR}{print}' infile
ATOM 1 N PRO A 15
ATOM 2 CD PRO A 15
ATOM 3 HD1 PRO A 15
ATOM 4 HD2 PRO A 15
ATOM 5 CA PRO A 15
ATOM 6 HA PRO A 15
ATOM 7 CB PRO A 15
ATOM 8 HB1 PRO A 15

Thanks a lot to all!
Goldoraak; it worked properly... :slight_smile:
adak