Shell Basics (iv) Uniq and Tee
Uniq is used to repeat the row, the most common option is only one, that is,-C count counts the number of repeated rows, and writes the number of repetitions in front.
Note: Use the premise that you need to sort the files first, otherwise it won't work.
#vim aming.txt "Write"
111
222
111
333
#uniq aming.txt "Separate use of uniq, do not remove duplicate lines that are not together."
111
222
111
333
#sort aming.txt |uniq "After using sort, use Uniq"
111
222
333
#sort Aming.txt |uniq-c
2 111
1 222
1 333
Note: #sort-u 1.txt = = #sort 1.txt |uniq
Tee command, redirection and dual output are occasionally used in the actual work
followed by the file name, similar to redirect, but the specific gravity of a function, the file is written in the following file in the same time, also displayed on the screen.
Tee is commonly used for pipe characters | Behind
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/8E/DF/wKiom1jN90-Ca47cAAAbncZiW6A779.png-wh_500x0-wm_ 3-wmp_4-s_795058769.png "title=" TT. PNG "alt=" Wkiom1jn90-ca47caaabncziw6a779.png-wh_50 "/>
This article is from the "Wu Fei" blog, please be sure to keep this source http://wutengfei.blog.51cto.com/10942117/1908073
Shell Basics (iv) Uniq and Tee