首页 > 其他分享 >sed command & regular expression error All In One

sed command & regular expression error All In One

时间:2022-10-26 00:13:25浏览次数:50  
标签:multi camel text sed command line txt expression

sed command & regular expression error All In One

read data & write data

regexp error

# /regexp/ 正则表达式后面少了一个 `/` ❌
sed "s/div/XYZ" ./multi-line-text.txt

# sed: 1: "s/div/XYZ": unterminated substitute in regular expression

solution

# /regexp/ 正则表达式后面少了一个 `/` ✅
sed "s/div/XYZ/" ./multi-line-text.txt >> multi-line-text.md

<div>line 01</div>
<div>line 02</div>
<div>line 03</div>
<div>line 04</div>
<div>line 05</div>
<div>line 06</div>
<div>line 07</div>
<div>line 08</div>
<div>line 09</div>
<div>line 10</div>

# sed `默认`不会直接修改源文件, 只是返回一个 STDOUT ✅
# sed "s/<div>/

标签:multi,camel,text,sed,command,line,txt,expression
From: https://www.cnblogs.com/xgqfrms/p/16826889.html

相关文章