bash - How to replace text contains'\n' with sed in macos 11.1
问题描述
I want to replace the text '123\nabc' to 'qqq',This is my code:
sed -i '' -e 's/"123\\nabc"/qqq/g' `grep "123\\nabc" -rl /Users/111/Desktop/1234`
The '/Users/111/Desktop/1234' is text document path. But it has an error which called ' bad flag in substitute command: '/''.I donot know how to replace it,Who can help me.
解决方案
利用perl
perl -i -pe 's/123\\nabc/qqq/g' /Users/111/Desktop/1234
推荐阅读
- python - 什么是“TypeError:'dict' 对象不可调用”?
- office365 - 调用 Microsoft Graph API 时出现 WAC 访问令牌错误
- r - 使用部分名称循环读取文件,以使用 fread(cmd=...) 和 rbindlist 在大型组合数据框中创建新变量
- python-3.x - 如何在另一个python文件(python3.7)中使用来自一个python文件的变量数据
- spring - JMS ActiveMQ 消费者,何时确认
- android - 如何从 Activity 调用小部件
- html - 如何删除或隐藏视频控件,不是全部,只有全屏和音量
- oracle - 项目值更改并刷新交互式网格后,IG 的查询不适用于更改的值
- scala - Scalatest 提供 NaN 的匹配器吗?
- linux - 查找行并在末尾附加文本不起作用