Linux shell command

Source: Internet
Author: User
Tags sorts

(1) Manipulating a file and slicing the file query rows

  

grep ' XXX ' Cut 2 (or 1-2)

(2) The operation of the file to remove the weight and show the number of repetitions

grep ' xxx ' Cut 2 Sort Uniq -C

(3) View total number of totals rows

grep ' XXX ' Cut 2 Sort Uniq WC -L

Sort : sorts the contents of the text file.

sort-u [File] = sort [File] | Uniq (de-weight)

Parameter description

-B ignores whitespace characters that begin before each line

-c Check that the files are sorted in order

-D sorting, ignoring other characters, in the case of English letters, numbers, and whitespace characters

-f Sort, lowercase letters are considered uppercase

-L when sorting, ignoring other characters except ASCII characters between 040 and 176

-M merges several sorted files

-M sorts the preceding 3 characters according to the abbreviation of the month

-n Sort by numeric size

-o< output File > Tell the sorted result into the specified file

-R sorted in reverse order

-t< separator character > Specify the field segment character to use when sorting

+< start >-< End fields > Sort by a specified field, ranging from the start to the previous field in the End field

--HELP Display Help

--version displaying version information

-U leaves only one row for rows that are considered identical after sorting

Uniq: checks and deletes duplicate rows in a text file.

syntax : uniq[options] File

most important parameters : Default (de-weight) |   -D (display weight) | -U (delete weight)

Parameters

-C or--count shows the number of occurrences of the row next to each column

-D or--repeat displays only the rows that appear repeatedly

-f< field > or--skip-fields=< column > ignore compare specified field

-s< character position > or--skip-chars=< character position > Ignore comparison of specified characters

-U or--unique only show one row at a time

-w< character position > or--check-chars< character position > Specifies the character to compare

--help Help Information

--version Version Information

Linux shell command

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.