Shell programming (eight) text viewing and processing tools

Source: Internet
Author: User
Tags diff

Text viewing and processing tools: WC, cut, Sort, Uniq, diff, Patch


Wc:word Count

WC [OPTION] ... [FILE] ...

-l:lines

-w:words

-c:bytes


Cut

Cut OPTION ... [FILE] ...

OPTION:

-D CHAR: Delimiter with the specified character;

-F Fields: the selected field;

#: The specified single field;

#-#: multiple consecutive fields;

#,#: discrete multiple fields;


Sort

Sort [OPTION] ... [FILE] ...

-N: Sort based on numeric size instead of characters;

-T CHAR: Specifies the delimiter;

-K #: The field used for sorting comparisons;

-R: Reverse order;

-F: Ignore character case

-U: Duplicate lines retain only one copy;

Complex line: continuous and identical;


Uniq: report or remove duplicate rows

Uniq [OPTION] ... [INPUT [OUTPUT]]

-C: Shows the number of repetitions per line;

-U: Displays only rows that have not been duplicated;

-D: Displays only the rows that have been repeated;


Diff:compare Files line by line

diff [OPTION] ... FILES


Diff/path/to/oldfile/path/to/newfile >/path/to/patch_file

-U: Using the unfied mechanism, which displays the context of the row to be modified, the default is 3 rows;


Patch: Patching Files

Patch [OPTIONS]-i/path/to/patch_file/path/to/oldfile


Patch/path/to/oldfile </path/to/patch_file


Exercise: Remove the IP address from the ifconfig eno16777736 command result;


Shell programming (eight) text viewing and processing tools

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.