Shell script Learning Guide-text processing tools

Source: Internet
Author: User

Shell script Learning Guide-text processing tools 1. sort usage sort-t:-k1, 1/etc/passwd --- sort by user name sort-t:-k3nr/etc/passwd --- sort by Reverse UID-k3nr, 3 ---- start from Field 3, reverse sort by value type, and end with sort-t at the end of Field 3: -k4n-k3n/etc/passwd --- sort-t:-k4n-u/etc/passwd by GID and UID --- sort several important options by unique GID-u: remove duplicate rows in the output row-r: change to descending order-o: Redirect File-n: sort by numerical Class 2. delete duplicate row uniq command uniq-d only show duplicate records uniq-u only show non-Repeated Records 3. number of calculated rows, number of words, and number of characters wc default output is the number of lines, number of words and characters-l number of calculated rows-w calculated words-c Calculated number of characters 4. extract the first 10 rows of rows starting or ending with head-10sed 10q and then 10 rows of tail-10 tail-f for dynamic viewing

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: 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.