Rename with a different condition

Hello

I have a file like this

a aa:::+
b aa:::+
c aa:::-
d ab:::+
e ab:::+
f ac:::+
g ac:::+
h ac:::-

Desired output

a aa:::+
b aa:::+
c aa.1:::-
d ab:::+
e ab:::+
f ac:::+
g ac:::+
h ac.1:::-

Logic
a. dont worry about column1.
b. in column2, after the tri-colon delimiter look at the plus (or) minus sign.
c. if the name (aa,ab...) before the tri-colon delimiter is same but is having a different sign compared to the other records with the same name, then append this records name with the occurrence number

Thanks

What operating system are you using?

What shell are you using?

With well over 350 posts in this forum we would expect that you would have a very good idea of how to handle a request like this yourself! What have you tried to solve this problem on your own?

Hi Don,

I did try this from an online search

awk 'cnt[$2]++{$2=$2":::"cnt[$2]-1} 1'

But it doesn't take the plus or minus sign into consideration.