当前位置:网站首页>The programmer shell with a monthly salary of more than 10000 becomes a grammar skill for secondary school. Do you often use it!!!
The programmer shell with a monthly salary of more than 10000 becomes a grammar skill for secondary school. Do you often use it!!!
2022-07-03 05:47:00 【Tell a joke】
List of articles
One 、 Regular expressions
1、 Introduction to regular expressions
Regular expressions describe a pattern of string matching (pattern), It can be used to check whether a string contains some kind of string 、 Replace the matching substring or take a string that meets a certain condition from a string, etc .
The component that builds a regular expression can be a single character 、 Character set 、 character in range 、 Choice between characters or any combination of all these components
2、 Regular expression symbols
① Basic symbols
| Symbol | describe |
|---|---|
| ^ | Match the beginning |
| $ | Match the end |
| […] | Matches any single character in the set |
| [^…] | Negate the set |
| . | Match any single character |
| * | Match the previous character any number of times |
| {n,m} | Match the previous character n~m Time |
| {n,} | Match the previous character at least n Time |
| {n} | Match the previous character n Time |
② Extended regular compatible regular symbols
| Regular sign | describe |
|---|---|
| \b | Match the boundaries of words |
| \w | Match character numeric underscores |
| \W | and \w contrary |
| \s | Match blanks |
| \d | Match the Numbers |
| \d+ | Match multiple numbers |
| \D | Match non numeric |
3、grep Grammar format
grep Options Matching mode file
Common options :
-v: Reverse match
-i: Ignore letter case
Two 、sed
1、sed What is it? ?
sed Is a non interactive streaming editor , You can add, delete, modify and query text , Mainly used to automatically edit one or more files 、 Simplify file manipulation 、 Write conversion program, etc
2、sed elements of grammar
Format :
· sed [ Options ] ‘[ Locator ] Instructions ’ file name
· sed [ Options ] ‘[ Locator ] Instructions ’
Common options :
-n: Mask default output
-i: Modify the source file directly (sed The source file will not be modified by default , Only the results will be printed )
-r: Support extended regularization
① Line number locator
sed You can use the line number to locate the data content you need to modify
example :sed -n "3p" /etc/passwd // Print /etc/passwd pass the civil examinations 3 That's ok
② Regular locator
sed You can use regular matching to match the data you need , Then edit the corresponding content
example : sed -n "/^root/p" /etc/passwd
③ sed Multi line text processing
Commonly used instructions :
i(insert): Insert
a(append): Additional
r(read): Read the file | Import file content
w(write): file save as | Export file content
3、 ... and 、awk Process control
1、awk What is it? ?
awk Is a language that processes text , Is a powerful text analysis tool , Is a powerful line by line processing software , Read one line at a time , Match the regular and then process , Check input text based on pattern matching , Line by line processing and output , Usually used for re shell Script , Get the specified data . When used alone , Statistics can be made on the text data
2、awk Command format
Format :
· Front order | [ Options ] ‘[ Conditions ]{ Instructions }’
·awk [ Options ] ‘[ Conditions ]{ Instructions }’ file
Common options :
-F: You can specify the separator , The default separator is ( Space or Tab key )
① awk Built-in variables ( Built in variables have special meanings , You can use it directly
| Variable | describe |
|---|---|
| FS | Save or set field separator , for example FS=":" , And -F Function as |
| $n | Specify the number of divisions n A field , Such as $1、$3 Separate indication control 1、 The first 3 Column |
| $0 | The entire line of text currently read |
| NF | Record the number of fields in the current processing line ( Number of columns ) |
| NR | Record the number of currently read rows ( Row number ) |
② awk Filtering time
Format : awk ‘BEGIN{} [ Conditions ]{} END{}’ file
- BEGIN{} Process before all lines , Execute... Before reading the first line of text , Generally used to initialize
- {} Deal with line by line , Read the text line by line and perform the corresponding processing ,
- END{} Execute... After processing the last line of text , Generally used to output results
边栏推荐
- chromedriver对应版本下载
- [escape character] [full of dry goods] super detailed explanation + code illustration!
- [teacher Zhao Yuqiang] redis's slow query log
- Get and monitor remote server logs
- Linux登录MySQL出现ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
- Qt读写Excel--QXlsx插入图表5
- 【一起上水硕系列】Day 7 内容+Day8
- Btrfs and ext4 - features, strengths and weaknesses
- Best practices for setting up altaro VM backups
- Shanghai daoning, together with American /n software, will provide you with more powerful Internet enterprise communication and security component services
猜你喜欢

Kubernetes resource object introduction and common commands (V) - (configmap)
![[teacher Zhao Yuqiang] use Oracle's tracking file](/img/0e/698478876d0dbfb37904d7b9ff9aca.jpg)
[teacher Zhao Yuqiang] use Oracle's tracking file

Introduction to redis using Lua script

【一起上水硕系列】Day 7 内容+Day8

Simpleitk learning notes

Altaro virtual machine replication failed: "unsupported file type vmgs"

MySQL 5.7.32-winx64 installation tutorial (support installing multiple MySQL services on one host)

卷积神经网络CNN中的卷积操作详解

Redhat7 system root user password cracking
![[teacher Zhao Yuqiang] index in mongodb (Part 1)](/img/2d/277ec737f2a7065831a19d036e61e1.jpg)
[teacher Zhao Yuqiang] index in mongodb (Part 1)
随机推荐
[function explanation (Part 2)] | [function declaration and definition + function recursion] key analysis + code diagram
[untitled]
chromedriver对应版本下载
70 shell script interview questions and answers
kubernetes资源对象介绍及常用命令(五)-(ConfigMap)
Altaro VM backup getting started
Sophomore dilemma (resumption)
[teacher Zhao Yuqiang] Cassandra foundation of NoSQL database
Source insight automatic installation and licensing
Azure file synchronization of altaro: the end of traditional file servers?
Common exceptions when Jenkins is released (continuous update...)
@Solutions to null pointer error caused by Autowired
Introduction to redis using Lua script
Communication - how to be a good listener?
Strategy pattern: encapsulate changes and respond flexibly to changes in requirements
期末复习(day3)
AtCoder Beginner Contest 258(A-D)
Pytorch through load_ state_ Dict load weight
Altaro set grandfather parent child (GFS) archiving
[teacher Zhao Yuqiang] use the catalog database of Oracle