Shell Special character _cut Command sort_wc_uniq command tee_tr_split command shell

Source: Internet
Author: User

8.10 Shell Special Character _cut command

* Any of any characters
? Any one character
#注释符号
\ de-Justification symbol
| pipe character
"$" the symbol with "!" "!$" means the last variable in the previous command
";" Delimiter, use "~" User's home directory when running two and more than two commands in one row (root user "/root", "/home/username" for normal user)
"&" If you want to put a command directly in the background, you can add this symbol at the command line (usually for very long running commands)
"[]" the middle bracket is a combination of characters, which represents any of the intermediate characters.
Cut command
The Cut command is used to display the specified part of the row, deleting the specified field in the file. Cut is often used to display the contents of a file, similar to the following type command. Note: This command has two functions, one is to display the contents of the file, it reads the file specified by the parameter files, the contents of the output to the standard output, and the other is to connect two or more files, such as Cut FL F2 > F3 will combine the file FL and a few of the content, They are then placed in the file F3 by the output redirect ">".

Syntax: cut-d ' delimiter ' [-CF] n [filename] (here n is a positive integer)
-D: Specify delimited symbols
-F: Specify paragraph
-C: There is only one number behind to intercept the first few characters, followed by a number area, indicating interception from a few to several (this option is not used in conjunction with D,F)

8.11 Sort_wc_uniq Command

Sort command
The sort command is very useful in Linux, which sorts the files and outputs the sort results standard. The sort command can get input from either a specific file or from stdin.

Syntax: sort [-t delimiter] [options] [filename]
Options:
-T: Specify delimiter
-N: Sort using pure numerals (system default all letters are 0)
-R: Reverse Sort
-u:=unique to repeat
-KN1,N2: Sorted by N1 interval to N2 interval, can write-kn1 only, i.e. sort N1 field (N1 < N2)
Sort does not have any options, then the first character is backward, followed by a Ascⅱ code value, and then the output is pushed up.

WC command
The WC command is used to calculate numbers. With the WC directive, we can calculate the number of bytes, words, or columns of a file. Syntax: WC [options] [filename]
Options:
-l:=line count rows
-m:=member Statistic character Count
-w:=word Number of statistical words
Note: Wc-m will count all the characters in the file, including the hidden newline character "&"; Wc-w is the phrase statistic with a space as a delimiter.

The Uniq command (unique) Uniq command is used to report or ignore duplicate rows in a file, and is generally used in conjunction with the Sort command (that is, to repeat). Syntax: uniq [options] [filename]
Options:
-c:=count shows the number of occurrences of the row next to each column
Description: Using the Uniq command directly, the 2.txt content display does not change, using sort sorting and then using the Uniq command, duplicate rows are merged, that is, you need to sort the files before you go to the weight!

8.12 tee_tr_split Command

Tee command
The tee command is used to redirect data to a file, deleting the original content in the file, and unlike ">", Tee will display the contents of the directed file. Syntax: tee [options] [filename]
Options:
-A: Use Append mode when redirecting to file (= ">>")

TR command
The TR command can replace, compress, and delete characters from standard input, it can change one character to another, or it can turn a set of characters into another set of characters.

Syntax: TR [source character] [target character]

Split command
The split command splits a large file into small files that sometimes need to be split into smaller pieces, such as for readability, log generation, and so on. Syntax: Split [options] [filename]
-B: Specify the size of each output file, the default unit is byte, customizable units, such as split-b 100M filename
-L: Specify the number of rows per output file
EG1: Specify Size

8.13 Shell special symbol (bottom)

Command connector: "| |", "&&", ";"

Command1; Command2: Executes Command2 regardless of whether Command1 executes successfully
Command1 && command2: Only Command1 execution succeeds Command2
Command1 | | Command2: Indicates Command1 execution succeeds, Command2 does not execute, otherwise execution Command2

Shell Special character _cut Command sort_wc_uniq command tee_tr_split command shell

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.