首页 > 解决方案 > 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.

标签: bashmacos

解决方案


利用perl

perl -i -pe 's/123\\nabc/qqq/g' /Users/111/Desktop/1234

推荐阅读