Guest_imported
New member
- Jan 1, 1970
- 0
Hi all,
I need a (gawk) script that counts the number of words in different textfiles, sorts them from high (left) to low (right), and copies this to a new file. Suppose the first file - named sport.txt - looks like this:
bird sport basket tennis basket guard victory basket guard victory
This becomes:
basket guard victory bird sport tennis
and should be automatically copied to a file, named sport.key (so extension "txt" should be replaced with "key".
Suppose the second file - named war.txt - looks like this:
guns food defence shield defence victory guns victory rebels
This becomes:
guns defence victory food shield rebels
and should be copied to a new file, called "war.key".
I hope you can help me with this. Many thanks in advance!
sunny
ps: before I forget: if two or more words have the same frequency of occurence, the order in which these words occur, is of no importance.
I need a (gawk) script that counts the number of words in different textfiles, sorts them from high (left) to low (right), and copies this to a new file. Suppose the first file - named sport.txt - looks like this:
bird sport basket tennis basket guard victory basket guard victory
This becomes:
basket guard victory bird sport tennis
and should be automatically copied to a file, named sport.key (so extension "txt" should be replaced with "key".
Suppose the second file - named war.txt - looks like this:
guns food defence shield defence victory guns victory rebels
This becomes:
guns defence victory food shield rebels
and should be copied to a new file, called "war.key".
I hope you can help me with this. Many thanks in advance!
sunny
ps: before I forget: if two or more words have the same frequency of occurence, the order in which these words occur, is of no importance.