当前位置:网站首页>办公遇到的问题--
办公遇到的问题--
2022-07-05 21:16:00 【6666666666666er】
1.sed 遇到特殊字符
sed 模式分隔符
到目前为止,我们只使用过一种 分隔符,那就是 反斜杠(/)。
假设我们需要使用 sed 将输入源中的 /bin/sed 替换为 /home/yufei/bin/sed
因为 / 是模式分隔符,我们不得不对它进行转义,即 \/。
echo "/bin/sed" | sed 's/\/bin\/sed/\/home\/yufei\/bin\/sed/'
竖线 |
竖线(|) 应该是 反斜杠(/) 之外用的最多的分隔符了。
竖线能够显著改善 sed 模式语句的可读性。
例如上面的命令,我们使用竖线作为分隔符,则可重写为
echo "/bin/sed" | sed 's|/bin/sed|/home/yufei/bin/sed|'
2.最后一行读取
tail -n 1 tt.txt
我会得到一个空行。在我的情况下,我想得到bonjour。
用Awk:
awk '/./{ line=$0} END{print line}' tt.txt
3.空格分割字符串
awk -F【关键字】 '{print $n}'
match_name=`echo "$match_Array" | awk -F ":" '{print $1}' `
边栏推荐
- int GetMonth( ) const throw( ); What does throw () mean?
- 浅聊我和一些编程语言的缘分
- LeetCode: Distinct Subsequences [115]
- EN 438-7 laminated sheet products for building covering decoration - CE certification
- Learning robots have no way to start? Let me show you the current hot research directions of robots
- Binary search
- Five layer network protocol
- vant 源码解析 之深层 合并对象 深拷贝
- [daily training] 729 My schedule I
- PVC plastic sheets BS 476-6 determination of flame propagation properties
猜你喜欢

示波器探头对测量带宽的影响
![[case] Application of element display and hiding -- element mask](/img/6e/6ea484a6e5d547e01dd8820af8e314.png)
[case] Application of element display and hiding -- element mask

Interviewer: will concurrent programming practice meet? (detailed explanation of thread control operation)

事项研发工作流全面优化|Erda 2.2 版本如“七”而至

Influence of oscilloscope probe on measurement bandwidth

显示屏DIN 4102-1 Class B1防火测试要求

【案例】定位的运用-淘宝轮播图

2022-07-03-cka- latest feedback from fans

leetcode:1139. The largest square bounded by 1

ArcGIS栅格重采样方法介绍
随机推荐
木板ISO 5660-1 热量释放速率摸底测试
Influence of oscilloscope probe on measurement bandwidth
Sequence alignment
校招期间 准备面试算法岗位 该怎么做?
bazel是否有学习的必要
100 cases of shell programming
Careercup its 1.8 serial shift includes problems
ODPs next map / reduce preparation
思特奇加入openGauss开源社区,共同推动数据库产业生态发展
Evolution of zhenai microservice underlying framework from open source component encapsulation to self-development
EN 438-7建筑覆盖物装饰用层压板材产品—CE认证
js常用方法封装
postgres 建立连接并删除记录
The transformation based on vertx web sstore redis to realize the distributed session of vertx HTTP application
[daily training] 729 My schedule I
CareerCup它1.8 串移包括问题
树莓派4B上ncnn转换出来的模型调用时总是崩溃(Segment Fault)的原因
示波器探头对测量带宽的影响
Clion-MinGW编译后的exe文件添加ico图标
postgis 安装地理信息扩展