I have one text like the following: (words, word domains)car transportcar machinebank economybank politicsbank parksGod 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 2bank 3God 1and pass those numbers tobank 4 3.2bank 3 1.5bank 2 0.9God 3 2.1The first part I thought of gawk 'NR==FNR {a[$1]++;next;} dont know what here?' list matrixI know its a little bit complex, but any help is appreciated. Maybe another way is easier?
text processing (reading and computing from two files) [awk, script]
text processing;awk;gawk