当前位置:网站首页>办公遇到的问题--
办公遇到的问题--
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}' `
边栏推荐
- How to prepare for the algorithm interview and answer the algorithm interview questions
- 校招期间 准备面试算法岗位 该怎么做?
- Add ICO icon to clion MinGW compiled EXE file
- Interviewer: will concurrent programming practice meet? (detailed explanation of thread control operation)
- Influence of oscilloscope probe on signal source impedance
- 思特奇加入openGauss开源社区,共同推动数据库产业生态发展
- PVC plastic sheets BS 476-6 determination of flame propagation properties
- 2022-07-03-cka- latest feedback from fans
- systemd-resolved 开启 debug 日志
- Comprehensive optimization of event R & D workflow | Erda version 2.2 comes as "7"
猜你喜欢

MySQL 千万数据量深分页优化, 拒绝线上故障!

Haas506 2.0 development tutorial - Alibaba cloud OTA - PAC firmware upgrade (only supports versions above 2.2)

CLion配置visual studio(msvc)和JOM多核编译

Access Zadig self-test environment outside the cluster based on ingress controller (best practice)

Comprehensive optimization of event R & D workflow | Erda version 2.2 comes as "7"

Arcgis\qgis no plug-in loading (no offset) mapbox HD image map

XML modeling

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

LeetCode_哈希表_困难_149. 直线上最多的点数

MySQL InnoDB Architecture Principle
随机推荐
The transformation based on vertx web sstore redis to realize the distributed session of vertx HTTP application
Display DIN 4102-1 Class B1 fire test requirements
Get JS of the previous day (timestamp conversion)
当用户登录,经常会有实时的下拉框,例如,输入邮箱,将会@qq.com,@163.com,@sohu.com
MySQL 千万数据量深分页优化, 拒绝线上故障!
Longest swing sequence [greedy practice]
Mode - "Richter replacement principle"
EasyExcel的读写操作
How to send samples when applying for BS 476-7 display? Is it the same as the display??
Talk about my fate with some programming languages
Wood board ISO 5660-1 heat release rate mapping test
selenium 获取dom内属性值的方法
Which securities company is better and which platform is safer for stock account opening
CLion配置visual studio(msvc)和JOM多核编译
Aitm 2-0003 horizontal combustion test
Binary search
Write an interface based on flask
Aitm2-0002 12s or 60s vertical combustion test
Monorepo management methodology and dependency security
Utils/index TS tool function