当前位置:网站首页>办公遇到的问题--
办公遇到的问题--
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}' `
边栏推荐
- EasyExcel的讀寫操作
- [case] Application of element display and hiding -- element mask
- 模式-“里氏替换原则”
- Realize the function of verifying whether the user has completed login when browsing the page
- Teach yourself to train pytorch model to Caffe (I)
- poj 3414 Pots (bfs+线索)
- Learning robots have no way to start? Let me show you the current hot research directions of robots
- Wood board ISO 5660-1 heat release rate mapping test
- int GetMonth( ) const throw( );后面的throw( )什么意思?
- Pytorch实战——MNIST数据集手写数字识别
猜你喜欢
Clion-MinGW编译后的exe文件添加ico图标
Golang(1)|从环境准备到快速上手
[case] Application of positioning - Taobao rotation map
使用WebAssembly在浏览器端操作Excel
Reading and writing operations of easyexcel
让开发效率飞速提升的跨端方案
Using webassembly to operate excel on the browser side
Why can't Chinese software companies produce products? Abandon the Internet after 00; Open source high-performance API gateway component of station B | weekly email exclusive to VIP members of Menon w
显示器要申请BS 476-7 怎么送样?跟显示屏一样吗??
基于flask写一个接口
随机推荐
Aitm2-0002 12s or 60s vertical combustion test
Introduction to TS, constructor and its this, inheritance, abstract class and interface
【案例】定位的运用-淘宝轮播图
123456
【案例】元素的显示与隐藏的运用--元素遮罩
Introduction of ArcGIS grid resampling method
Golang (1) | from environmental preparation to quick start
水泥胶黏剂BS 476-4 不燃性测试
树莓派4B上ncnn转换出来的模型调用时总是崩溃(Segment Fault)的原因
概率论机器学习的先验知识(上)
XML modeling
[case] Application of element display and hiding -- element mask
当用户登录,经常会有实时的下拉框,例如,输入邮箱,将会@qq.com,@163.com,@sohu.com
Longest swing sequence [greedy practice]
Deployment of Jenkins under win7
Using webassembly to operate excel on the browser side
Sequence alignment
Is it necessary for bazel to learn
字典树简单入门题(居然是蓝题?)
示波器探头对信号源阻抗的影响