Awk: Words frequency from one text file, how to ouput into myFile.txt?

后端 未结 3 1907
心在旅途
心在旅途 2021-01-25 22:51

Given a .txt files with space separated words such as:

But where is Esope the holly Bastard
But where is

And the Awk f

3条回答
  •  悲哀的现实
    2021-01-25 23:41

    Just use shell redirection :

     echo "test" > overwrite-file.txt
     echo "test" >> append-to-file.txt
    

    Tips

    A useful command is tee which allow to redirect to a file and still see the output :

    echo "test" | tee overwrite-file.txt
    echo "test" | tee -a append-file.txt
    

    Sorting and locale

    I see you are working with asian script, you need to be need to be careful with the locale use by your system, as the resulting sort might not be what you expect :

    * WARNING * The locale specified by the environment affects sort order. Set LC_ALL=C to get the traditional sort order that uses native byte values.

    And have a look at the output of :

    locale 
    

提交回复
热议问题