版权声明:转载请注明出处. https://blog.csdn.net/laodaliubei/article/details/84482524
Contents
Preface
The manual of OS is the most detailed . However, it’s complicated.
As a result:
- if you can find what you need to solve your problem, enough!
- If you wanna know more , please read the manual, although it may be hard in case of poor English. No pain no gain.
First of all , Let’s have a look at “man”.
man
man用法小结
Usage: man [章节号] name
- man是按照章节号搜索的,找到一个就不再继续了.这种算法在IT领域很常见,比如在python中搜索包, 在Django中搜特定文件.
- 如果想全都看 man -a keyword
每显示完一个选项目录按q键进入下一个选项目录 如想直接跳出,按: ctrl + z
Related to files
- rename
Rename: %now, in ubuntu use Perl version, stronger%
Mostly used 2 kinds : substitute / transfer . - Substitute: s/PATTERN/REPLACEMENT/Mode egimosx
最后面是模式修正符
e: Evaluate the right side as an expression.
g:Match globally, i.e. all occurrences.
i:Case-insensitive pattern matching.
m;Treat string as multiple lines.
o:Only compile pattern once, even if variables within it change.
s:Treat string as single line.
x:Use extended regular expressions
- Transfer: y/SEARCHLIST/REPLACEMENTLIST/cds or tr/SEARCHLIST/REPLACEMENTLIST/cds
e.g.: lab1_result lab2_result …… lab1 lab2…… by rename ‘s/_result//’ *_result
转换跟替换不同,替换是将replacement整个字符串替换pattern字符串,而转换则是用replacement逐个字符替换pattern逐个字符,结果依赖于replacement与pattern字符个数.