Shell Special character Cut command
- Any of any characters
? Any one character
#注释字符
\ de-Semantic characters
·
| pipe character
Cut intercept string
-D Specify delimiter
-f Specifies the Intercept paragraph
By looking at what we can see,/etc/passwd is divided into 7 segments.
·
If you use ":" to intercept the first paragraph of the delimiter
·
Intercept the first to second paragraph (comma in English)
·
Intercept one to three segments (with a horizontal bar)
·
-c Specifies the number of characters (use-C does not use-d-f)
·
·
·
·
sort_wc_uniq CommandSort sorts
Sort it alphabetically by using sort
·
When a file has numbers, letters, and special symbols the sort default is a special symbol, a number, a letter, and if the first character is the same then the second character is compared.
• We copy the/etc/passwd to a TXT document Lee, and then add a number to the beginning of the special symbol, the beginning of the content
·
Save after exiting we're sort of 1.txt
·
As you can see, the sort is a special symbol on the top, the following is the number sort, and the following is the letter
·
-N is numerically sorted (the first character other than the number in the-n case is considered to be 0, which is the front)
·
-R Reverse Order
·
-T delimiter
·
Wc-l count rows
·
Wc-m statistic character count (line break $)
·
WC-W statistical terms (delimited by spaces)
·
Uniq (only the same two lines together to go heavy, so it is generally used with the sort)
·
-C Statistic Repetition number
·
·
·
·
·
Tee_tr_split commandTee is similar to redirecting ">", but it shows the content of the redirect, which is the equivalent of a visualization, and the need to add a pipe character when using
·
-A Append
·
TR Replacement Character
·
You can specify a single character substitution, or you can specify a range substitution
·
Split cutting (cutting large files into multiple small files)
-b Specifies how big it is for a cut (no unit is specified by default unit is byte)
-l Specifies how many lines of content are a cut
·
The cut-off file name defaults to the beginning of X, and of course we can specify the prefix
·
·
·
·
·
Shell Special SymbolsThe prefix of the $ variable, the!$ combination, and the regular inside represents the end of the line.
Multiple commands are written to one line, separated by semicolons.
`
~ User home Directory, which represents a match in a regular expression.
& put the command behind the command and put it in the background.
Override redirect,>> redirect,2> error redirect,2>> error append redirect,&> correct and error output redirect.
[] One of the specified characters, [0-9] [a-za-z] [ABC]
ll or the meaning (if the first command execution is unsuccessful, the second is executed, if the first one succeeds no longer executes the second article)
`
&& if the previous command executes successfully, the following command will be executed with && (if the previous command does not succeed, the subsequent command will not be executed)
Shell Special character _cut Command sort_wc_uniq command tee_tr_split command