I have an input file that looks like:
text
6
1w 1 3.450 1.324 2.915
1w 2 3.450 1.324 2.915
4w 2 3.458 1.379 2.837
4w 1 3.458 1.379 2.837
7w 2 3.364 1.345 2.951
7w 2 3.364 1.345 2.951
and I want the output file to look like:
text
6
1w N 3.450 1.324 2.915
1w H1 3.450 1.324 2.915
4w H2 3.458 1.379 2.837
4w N 3.458 1.379 2.837
7w H1 3.364 1.345 2.951
7w HW2 3.364 1.345 2.951
For the second column, the numbers 1 2 2 1 2 2, I need to print "N" for 1 and "H1" and "H2" for 2 and than again NH1H2, so I mean to tell the program to change once 2 for H1 and then H2. I used
if(p==1)p="N"
if(p==2)p="H1"
but I have no idea how to put do cycle to tell the second 2 is H2 not H1. Can you suggest what to do?