当前位置:网站首页>Solve the problem of sed replacement text containing special characters such as "/" and "#"
Solve the problem of sed replacement text containing special characters such as "/" and "#"
2022-08-10 02:12:00 【Yang Linwei】
If we use the sed command, if there are special characters, an error may be reported. The example is as follows:
# / cannot be used as a delimiter, because it will conflict with the content insidesed -i 's/flink//etc/g'# pound sign# cannot be used as a delimiter, because it will conflict with the content insidesed -i 's#jdbc://127.0.0.1&password=1#aa$username=root#g'# @ cannot be used as a delimiter, because it will conflict with the content insidesed -i '[email protected]://[email protected][email protected]'
How to solve it?
We have to look inside to choose a specific delimiter, for example:
- It contains "/", you can choose "#" or "@" as a delimiter;
- It contains "#", you can choose "@" or "/" as the delimiter;
- contains "@", you can choose "/" or "#" as the delimiter.
So what if all of the above were included?The escape character "\" can only be used in the replaced text, such as:
sed -i 's/oracle/\/etc\/oracle/g'
边栏推荐
- 03|Process Control
- Xi'an biotin-tetrapolyethylene glycol-amide-4phenol light yellow semi-solid
- Unity顶点动画
- -红与黑-
- 基于Web的疫情隔离区订餐系统
- el-input保留一位小数点
- How to turn off system protection in Win11?How to turn off the system protection restore function?
- 以太网PHY芯片LAN8720A芯片研究
- 【报错】ModuleNotFoundError: No module named ‘scp‘
- 生物素叠氮化物中的(CAS:1527486-16-3TAMRA-azide-PEG3-Biotin)反应的特点!
猜你喜欢
Web性能测试模型小结
生物素叠氮化物中的(CAS:1527486-16-3TAMRA-azide-PEG3-Biotin)反应的特点!
数据建模已死,真的吗?
PEG derivative Biotin-PEG1-OH (cas: 95611-10-2, 2-biotinaminoethanol) advantage description
基于Web的疫情隔离区订餐系统
2022金九银十工作潮,怎么样才能成功跳槽面试拿到高薪呢?
20220809-PotPlayer如何设置默认字体色-设置默认字体色的方法
Pyscript,创建一个能执行crud操作的网页应用
西安生物素-四聚乙二醇-酰胺-4苯酚 浅黄色半固态
手把手教你编写性能测试用例
随机推荐
C语言头文件组织与包含原则
小程序中计算距离信息
渗透测试与攻防对抗——漏洞扫描&逻辑漏洞(Part1)
@PostConsturct注解作用及特点
什么是 PWA
为什么字符串一旦创建就不可以改变?
生物素叠氮化物中的(CAS:1527486-16-3TAMRA-azide-PEG3-Biotin)反应的特点!
Fedora 36 dnf 安装ModSecurity和 OWASP 核心规则集
GBJ1510-ASEMI机器人电源整流桥GBJ1510
温度响应性纳米水凝胶光子品体/纤维素修饰荧光水凝胶/载脂质体水凝胶的制备方法
【无标题】
罗彻斯特大学 | 现在是什么序列?蛋白质序列的贝叶斯优化的预训练集成
D-Biotinol Involved by Biotin, CAS No: 53906-36-8 Specific Properties Description
eyb:Redis学习(4)
CAS:183896-00-6 (Biotin-PEG3-C3-NH2) PEG derivative
CVPR22 Oral|通过多尺度token聚合分流自注意力,代码已开源
ABAP 里文件操作涉及到中文字符集的问题和解决方案
防勒索病毒现状分析
MySQL最大连接数限制如何修改
Unity image使用长图后 图片很糊