I have one text like the following: (words, word domains)
car transport
car machine
bank economy
bank politics
bank parks
God religion
...
There are numerous words, some words have different domains and other have only one domain. I have another file, a huge matrix (300 dimensions each line) composed of words and a vector for each like this:
bank 0.9 1.5 3.2 -0.2 0.1 ...
God 1.0 2.1 -0.5 0.7 ...
rose 0.2 -1.8 ...
... ...
I would like to read how many times appears each word in the first file, and according to that choose the highest "n" numbers in each vector of the second file, knowing to which field it belongs. Something like this:
car 2
bank 3
God 1
and pass those numbers to
bank 4 3.2
bank 3 1.5
bank 2 0.9
God 3 2.1
The first part I thought of
gawk 'NR==FNR {a[$1]++;next;} dont know what here?' list matrix
I know its a little bit complex, but any help is appreciated. Maybe another way is easier?
4
forbank
,3
forGod
?