当前位置:网站首页>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'边栏推荐
- OSS-访问oss生成的url无法访问,直接下载问题
- C language structure, function and pointer exercise (simple address book)
- JVM :运行时数据区-虚拟机栈
- 3511. 倒水问题
- 365天挑战LeetCode1000题——Day 052 逐步求和得到正数的最小值 贪心
- 你有对象类,我有结构体,Go lang1.18入门精炼教程,由白丁入鸿儒,go lang结构体(struct)的使用EP06
- 跳房子游戏
- 你有对象类,我有结构体,Go lang1.18入门精炼教程,由白丁入鸿儒,go lang结构体(struct)的使用EP06
- c语言结构体、函数以及指针练习(简单通讯录)
- 【报错】ModuleNotFoundError: No module named ‘scp‘
猜你喜欢
随机推荐
win10重装系统后没声音怎么办?
[转] Typora_Markdown_图片标题(题注)
微信小程序tab切换时保存checkbox状态
走出迷宫的最少步数2
What do you know about FITC-labeled biotin (FITC-biotin|CAS: 134759-22-1)?
Solidity最强对手:MOVE语言及新公链崛起
你有对象类,我有结构体,Go lang1.18入门精炼教程,由白丁入鸿儒,go lang结构体(struct)的使用EP06
22.括号生成
使用 apxs 构建和安装 Apache 扩展共享对象模块
C# 四舍五入 MidpointRounding.AwayFromZero
Summary of basic operations of c language files
CAS:183896-00-6 (Biotin-PEG3-C3-NH2) PEG derivative
生物素叠氮化物中的(CAS:1527486-16-3TAMRA-azide-PEG3-Biotin)反应的特点!
eyb:Redis学习(4)
-采花生-
嵌入式Qt-实现两个窗口的切换
即时通讯开发如何撸一个WebSocket服务器
【kali-密码攻击】(5.2.1)密码分析:Hash Identifier(哈希识别)
R语言使用coxph函数构建生存分析回归模型,使用forestmodel包的forest_model函数可视化生存回归模型对应的森林图
Shader Graph学习各种特效案例







