linux-Basics-Day 18th

Source: Internet
Author: User

Text Processing tools: WC, cut, sort, uniq

WC command:

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

-l:lines

-w:words

-c:characters

Cut command:

Cut [OPTION] ... [FILE] ...

-D DELIMITER: Indicates delimiter

-F Fileds:

#: Section # Fields

#,#[,#]: Discrete multiple fields, such as 1,3,6

#-#: Multiple consecutive fields, such as 1-6

Mixed use: 1-3,7

--output-delimiter=string

Sort command:

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

-F: Ignore character case

-R: Reverse order

-T DELIMITER: Field delimiter

-K #: Sort the specified fields as standard

-N: Sorting by numeric size

-u:uniq, sort after go heavy

Uniq command:

Uniq [OPTION] ... [FILE] ...

-C: Shows the number of repetitions of each line;

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

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

Note: Repeat for continuous and identical sides

TR command: Convert or delete characters

TR [OPTION] ... SET1 [SET2]

Tee command:

Tee [OPTION] ... [FILE] ...

Split (option) (file) PREFIX:

-B: The value is the size of each output file, in bytes.

-C: The maximum number of bytes for a single line in each output file.

-D: Use a number as a suffix.

-L: The value is the size of the number of columns per output file.

PREFIX: Represents a leader character that can be used as a leading file for cutting files.

=

Variable name = value, assigning a value to the variable. Note = around the variable name and value, do not have spaces in the middle

$

Variable value substitution, $ variable name replaced with the value of the shell variable, to avoid confusion when text joins, use the ${variable name};$0...$9 to represent the parameters of the shell file.

>

Prog > file redirects the standard output to files.

>>

Prog >> file appends the standard output to files.

<

Prog < file get the standard input from files

|

Pipe command, example: P1 | P2 the standard output of the P1 as a standard input for P2

&

The biggest benefit of running commands in the background is that you can continue to enter commands under the same command line without waiting for the command to finish

()

Executing commands in a child shell

{}

Executes the command in the current shell, or uses the defined scope of the variable substitution (for example, the ${variable name} usage above).

;

The command terminator. For example, P1;P2 indicates that P1 is executed first and then P2

&&

The previous command executes successfully before the next command is resumed. Example: P1 && p2, if P1 execution succeeds, the P2 is executed, otherwise, p2 is not executed;

||

The previous command failed to continue execution of the next command. Example: P1 | | P2, if P1 execution succeeds, do not execute P2, vice versa, only execute P2;

!

Commands in the execution history

~

Home Directory


linux-Basics-Day 18th

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.