Shell Basics (iv) Uniq and Tee

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.