LinuxCommands review log-Linux general technology-Linux programming and kernel information. The following is a detailed description. In shell, file name replacement is different from Regexp. There are four types:
1. * match any string
2 ,? Match any single character
3. […] Match any character in []
4. [!…] Match characters after non-exclamation mark
Key character of the regular expression: [^ *? +. $], [\ {], And [\}]
Echo:
1.-n output without line feed
2.-e enables the escape character to take effect (by default, it will not be automatically escaped)
Read:
1. A behavior separator is used when a variable is read at a time.
2. When reading multiple variables at a time, use space as the Separator
Shell Command connection:
Command1 | if command2 1 fails, execute 2
If command1 & command2 1 is successful, execute 2
Command1; command2;... sequential execution
Grep:
Grep [options] PATTERN [files...]
Style: Double quotation marks ("mystring") are used for strings, and double quotation marks are used for variable calling. variables are enclosed by "{}" ("$ {MYVAR }"), single quotation marks ('\ W') are used for invocation mode matching ').
Option:
1.-c only outputs matched rows
2.-I is case insensitive
3.-n: display the matched row number.
4.-v: Show All unmatched rows
5.-E extension mode: extended regular expression ($ grep-E 'add | sub 'filename)
Query multiple files: $ grep "main" *. c
Awk:
1. FS defaults to null delimiter => OFS => NF
2. RS is a linefeed by default => ORS => NR
3. The value of each domain is $1-$ NF, and $0 is the record value.
4. Comparison [~] , [! ~] Mismatch
5. built-in string functions:
Gsub (r, s)
Gsub (r, s, t) Replace r with s in the entire t
Locate s in index (s, t) t
Length (s)
Match (s, r)
Split (s, a, fs)
Sprint (fmt, exp)
Sub (r, s)
Substr (s, p)
Substr (s, p, n) returns the suffix of n starting from p in s.
Sed:
1. Mode: [1, 9], [/START/,/END/]
2. Action: [= p s d rw gh]
3. Modify: \ I \ a \ c
Commands:
Whois whereis
Whatis apropos
Iconv encoding conversion
Head tail more less
Find sort tr
Stty set terminal properties
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