I have the file of about 300 hundreds lines
TITLE cargas
REMARK 1 File created by GaussView 5.0.9
HETATM 1 O 0 0.957 -0.000 -0.000 O
HETATM 2 H 0 0.000 0.000 0.000 H
HETATM 3 H 0 1.197 0.927 -0.000 H
HETATM 4 O 0 -1.664 -0.019 0.488 O
HETATM 5 H 0 -2.210 0.327 1.194 H
HETATM 6 H 0 -2.260 -0.104 -0.257 H
HETATM 7 O 0 2.189 -2.104 1.321 O
HETATM 8 H 0 1.559 -1.476 0.968 H
HETATM 9 H 0 1.764 -2.955 1.216 H
...
and I would like to have the following form of the previous file
TITLE cargas
REMARK 1 File created by GaussView 5.0.9
HETATM 1 O LIG 1 0.957 -0.000 -0.000 O
HETATM 2 H LIG 1 0.000 0.000 0.000 H
HETATM 3 H LIG 1 1.197 0.927 -0.000 H
HETATM 4 O HOH 2 -1.664 -0.019 0.488 O
HETATM 5 H HOH 2 -2.210 0.327 1.194 H
HETATM 6 H HOH 2 -2.260 -0.104 -0.257 H
HETATM 7 O HOH 3 2.189 -2.104 1.321 O
HETATM 8 H HOH 3 1.559 -1.476 0.968 H
HETATM 9 H HOH 3 1.764 -2.955 1.216 H
...
The first three rows have to say LIG and all the others HOH. The numeration of column 5 varies from 1 to 100 by three rows each number.
Thanks in advance for any help.