How to create a frequency list of every word in a file?

前端 未结 11 984
心在旅途
心在旅途 2020-12-04 09:59

I have a file like this:

This is a file with many words.
Some of the words appear more than once.
Some of the words only appear one time.

I

11条回答
  •  情书的邮戳
    2020-12-04 11:01

    You can use tr for this, just run

    tr ' ' '\12'  result.txt
    

    Sample Output for a text file of city names:

    3026 Toronto
    2006 Montréal
    1117 Edmonton
    1048 Calgary
    905 Ottawa
    724 Winnipeg
    673 Vancouver
    495 Brampton
    489 Mississauga
    482 London
    467 Hamilton
    

提交回复
热议问题