sed简单用法
一、替換
1、將替換后的文本顯示在屏幕上
sed?'s/pattern/replace_string/'?file或者通過管道
cat?file|sed?'s/pattern/replace_string/'2、替換源文件中的文本
sed?'s/pattern/replace_string/g'?file或者
sed?-i?'s/pattern/replace_string/'?file從第N處開始替換匹配的行
sed?'s/pattern/replace_string/Ng'?file二、刪除匹配的行
sed?'/pattern/d'三、用&來標(biāo)記匹配的字段
#sed?'s/mail/[&]/'?sent?|head?-20 send?[mail]?time Mon?Sep?29?03:16:49?CDT?2014四、組合表達(dá)式
sed?'expression1'|sed?'expression2'或者
sed?'expression1;expression2'?
五、引用
#?text=hello #?echo?"hello?world"?|sed?"s/$text/HELLO/" HELLO?world轉(zhuǎn)載于:https://blog.51cto.com/281816327/1617273
總結(jié)
- 上一篇: python3 UnicodeEncod
- 下一篇: ***Redis hash是一个stri