当前位置:网站首页>管道,重定向以及正则表达式
管道,重定向以及正则表达式
2022-07-21 17:30:00 【zjt597778912】
解释:
输入输出设备是计算机基本组成部分之一。
- 系统有设定的默认设备:
- 默认输出设备(标准输出):stdout,1。
- 默认输入设备(标准输入):stdin,0。
- 标准错误输出:STDERR,2。
- 标准输入:键盘。
- 标准输出和错误输出:显示器。
管道和重定向
- 输出重定向;
- >:使用命令cat /etc/passwd:则会使文件中的内容打印到屏幕上,这就是默认输出设备;而使用命令cat /etc/passwd > aaa:则会将文件中的内容输出到文件aaa中去,这就是输出重定向。
- 使用 > 重定向输出,会覆盖目标文件中原有内容。
- >>:追加输出重定向,使用该符号,不会覆盖目标文件中原有内容,而是在文件后面追加输出。
- 2>:重定向错误输出。
- 2>>:追加重定向错误输出。
- &>:重定向标准和错误输出。
- &>>:没有这个。。。
- 输入重定向;
- <:cat < /etc/passwd:从文件中输入,而不是键盘。
- <<:<<:END:此处生成文档,一般为END,EOF(结束符)。
- set:可以关闭或开启一个功能,使用man指令查找帮助使用,例如:
- -C:禁止对已经存在文件进行覆盖重定向。
- +C:关闭上述功能。
- 管道:命令
- 命令1|命令2|命令3…:前一个命令的输出作为后一个命令的输入。
- tee:读取输入,输出到文件和屏幕。
正则表达式
REGEXP(REGular EXPression)
- 原则:
- 尽可能长的匹配(贪婪模式)。
- 部分匹配。
- 元字符:注意与文件名通配区分
- . :匹配任意单个字符。
- *:匹配其前面的字符任意次(包括0次)。
- .*:任意长度的任意字符。
- \?:匹配前面字符1次或0次。
- \{m,n\}:匹配其前面的字符至少m次,至多n次。
- []:匹配指定范围内的任意单个字符。可参考文件名通配;
- [^]:匹配任意范围外的任意单个字符。
- 位置锚定:
- ^:锚定行首,此字符后面的任意内容必须出现在行首。
- $:锚定行尾,此字符前面的任意内容必须出现在行尾。
- ^$:匹配空白行。
- \<或者\b:锚定词首。其后面的任意字符必须作为单词首部出现。
- \>或者\b:锚定词尾。其后面的任意字符必须作为单词尾部出现。
- 分组:
- ():后向引用;括起来的部分可以被后面引用。
- \1:引用第一个小括号括起来的内容。
- \2:同上,等等。
扩展正则表达式
- 元字符:
- 包含以上所有字符且不用使用反斜线\ 。
- +:匹配其前面字符至少一次
- |:或者符号,例如a|bc:匹配a或者bc。(a|b)c:匹配ac或bc。
边栏推荐
- 科技创造价值 | 云扩科技荣登真榜·中国科技创新品牌榜TOP100
- 序列化和反序列化
- Conversion of JS time and timestamp
- 海思Hi3531||瑞芯微RK1109用rtsp客户端实现h264拉流
- Différence entre les versions Runtime + compilateur et Runtime only
- Excel中时间戳和时间的转换
- Soft exam intermediate [Database System Engineer] Chapter 1: computer system knowledge, self-study soft exam notes, preparation for the soft exam in May 2022, computer hardware system CPU composition
- 新手股票开户安全吗?网上可以办理吗?
- openlayers 使用canvas绘制圆形头像图标
- Must use destructuring props assignmenteslint
猜你喜欢
Solve the problem that the plug-in center of idea is not connected to the network
指针深度进阶《六》(二维数组相关知识)
不断提升认知,从而达到交易的最高级别——稳定盈利(终)
Formation and destruction of function stack frames (26 pictures help you understand function stack frames in depth)
序列化和反序列化
C#异常处理 | 连接成功但登陆异常/管道另一端上无任何进程Error: A connection was successfully established with the server, but
職業交易者自用多年的終極突破策略分享(附全套交易模板)
力扣之滑动窗口《循序渐进》(209.长度最小的子数组、904. 水果成篮)
Ffmpeg audio decoding (seconds understand)
"Everest" architecture strongly enables the third-generation Roewe rx5/ super hybrid erx5 to refresh the "ceiling" of product power
随机推荐
指针深度解刨《二》(指针指向自己)
量化交易中通过均线系统判断上涨(下跌)动能减弱
Machine learning by Li Hongyi 5 Tips for neural network design
Quantitative transaction Diary - summary in January 2021
In quantitative trading, it is judged by the moving average system that the upward (downward) momentum is weakened
scrollIntoView
mysql
Zhang Chi Consulting: How Six Sigma can help companies reduce customer complaints
What is RPA? Recommend automated tools that allow e-commerce operators to operate 10 times more efficiently
Partage de la stratégie de percée ultime des commerçants professionnels pendant de nombreuses années (avec un ensemble complet de modèles de transaction)
Pointer depth solution "II" (pointer points to itself)
类的加载机制以及双亲委托机制
QML drag pictures and objects across windows
交易进阶必由之路:从小白到稳定盈利(三)
"Everest" architecture strongly enables the third-generation Roewe rx5/ super hybrid erx5 to refresh the "ceiling" of product power
张驰咨询:某包装印刷集团第五期六西格玛项目通过专家评审
Soft test intermediate [Database System Engineer] Chapter 0: how to prepare for the test by self-study, test introduction, test preparation materials, size score distribution in the morning and aftern
Cannot read property ‘type‘ of undefined Occurred while linting **\index.jsx:1
Windows环境下Redis安装与配置的两种方式
李宏毅《机器学习》丨5. Tips for neural network design(神经网络设计技巧)