I have 20 files. In each file I have a list of the occurring words and their frequency.
Example:
2 représentant
3 reproduire
2 réseau
1 rester
3 reste
1 résumer
I used this command to merge between these 20 files
cat *.txt > tous.txt | sort | uniq -ci | sort -k3
The result was for example:
2 2 représentant
1 6 représentant
5 3 reproduire
2 3 reproduire
6 3 réseau
1 1 réseau
etc..
But what I want is to make it calculate the number of occurrence of each word without writing it many times. What I want is:
8 representant
6 reproduire
4 réseau
...
I can do it with awk:
awk '{tab[$2]+=$1} END {for(i in tab){printf("%7d %s\n", tab[i], i) | "sort -k2"}}' ~/Bureau/Projet/data/dico/*.dico.forme.txt > ~/Bureau/Projet/data/input/black.txt
Any other suggestions by using for ex if?