"Linux rookie 2" Shell Base command

Source: Internet
Author: User
Tags diff

Diff

diff file File1 to compare two different files

-C display rows around the top and bottom

-U uniformly output patches in a certain format

-R comparison of files in two directories

Patch File File.path Patching

-B Plus-B backup source files

grep

grep Key Character File | Directory finds rows in a file or directory that contain keywords

Grep-i ignoring case

-n Displays the keyword in the row

- C Show Filter Knot Number of fruits

-V Reverse Filter

- e "keyword 1| keyword 2" filters multiple keywords

-R directory to find files in the directory that contain keywords

Note: The ^ keyword starts with a keyword

Keyword $ ends with keyword

Cut

Cut intercept characters

Cut-d delimiter Specifies delimiter

Cut-f 1.7 Displays the specified column

Cut-c 1-4 shows first to fourth characters

Sort sorts

-N Pure Digit sort

-U de-redundancy

|uniq-c Redundancy and Count redundancy

-T Specify delimiter

-k Specifies the column

Uniq

Sort-n file |uniq-c redundancy and Count redundancy

-D Show redundant rows

-U displays unique rows

Sed

Sed ' s/original character/replacement character/g ' file

Sed-e ' Strategy 1 '-e ' strategy 2 '

Sed-i file to enter the converted content into the specified files

Sed ' 3,5s/original character/replacement character/g ' 3-5 line substitution

Sed ' 3s/original character/replacement character/g ' 3rd line substitution

SED xd mask specified line

Sed XP replicates the specified line

Sed-n XP displays only the specified lines

awk

awk ' condition type {action 1} condition type {action 2} ... ' filename

Awk primarily handles data in the fields of each row, and the default field delimiter is the Space or TAB key

awk numeric operator

+ +--increase and decrease (front or rear)

^** index (right binding)

! +-Non, unary plus, unary minus

*/% multiply, divide, remainder

+-Add, subtract

<<===!=>>= comparison

&& Logic and

|| Logical OR

? : Ternary Conditional type

=+=-=*=/=%=^=**= Assignment (right-associative)

awk built-in scalar variables

FileName The name of the current input file

FNR the number of records for the current input file

FS field delimiter (regular expression)

NF the number of fields currently logged

NR number of records at Work (job)

OFS output Field delimiter

ORS Output Record delimiter

RS Input Record delimiter


This article from the "12147236" blog, reproduced please contact the author!

"Linux rookie 2" Shell Base 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.