單一檔案
如 story.txt 的內容如下
Connection pool
From Wikipedia, the free encyclopedia
Jump to: navigation, search <find me>
可以下指令使用
#cat story.txt | sed "s/<find me>/yes/g"
Connection pool
From Wikipedia, the free encyclopedia
Jump to: navigation, search yes
將 "<fine me>" 取代成 "yes"
若是要直接修改檔案,請加上 -i
#sed -i "s/<find me>/yes/g" story.txt
多個檔案
# find *.conf | xargs -i sed -i 's/senor/sensor/g' {}
文章標籤
全站熱搜