当前位置:网站首页>Sed technique

Sed technique

2022-06-22 01:20:00 winux

Replace only those that match the context pattern, such as : If c It is not the letter that follows A, will c Switch to b

echo "c.cAcf" | sed 's/c/([^A]/)/b/1/g'
Output b.cAbf

 

Precede the line that matches the rule , Insert a specific character

 

echo "abcef" | sed '/ab/ s/^/#/'

 

among /ab/ It's a regular expression , Used to match a line ,

s/^/#/ Command is replace , ^ At the beginning of the line

原网站

版权声明
本文为[winux]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206212352009710.html