Merge Static and dynamic parts in variable declaration

Dear Unix experts

Moved from "Shell Programming and Scripting "
I want to define a variable which contains dynmic and static part, daynamic part is the first field.

Sample of data

dddd aaaa sssss 12345
ssss 2323 234234 4242
dddd 3223 34234 54353
ssss 24234 3434 42342
dddd rwrw 423423 werwer

Code:

nawk 'BEGIN {FS=" "}{ $1"_subs"=$1"_subs"+1}END {print dddd_subs}'

it should give me 3

but it gives me error "nawk: syntax error at source line 1
context is

BEGIN {FS=" "}{ >>> $1"_"subs= <<< $1"_"subs+1}
nawk: illegal statement at source line 1"

Can you please help ?
Many thanks in advance

I also tried

Code:

nawk 'BEGIN {FS=" ";diff[$2]=2}{ subs[$1]=+1}END {print subs[dddd], diff [rwrw]}

, Also error...

Can any one advise how to do it in any of the ways above

Could you elaborate more on how the expected output of 3 should be calculated?

---------- Post updated at 03:11 PM ---------- Previous update was at 02:16 PM ----------

Thread reopened because in the Emergency forum.

Try this:

nawk 'BEGIN {FS=" "} {subs[$1]++} END {for (i in subs) print i, subs}'

Your last version uses a field variable, $2, in a BEGIN statement.
This is not valid because when the BEGIN statement executes no
data has been read, therefore there is no $2 field variable.