2015年11月19日 星期四

sed

搜尋並取代
sed -i 's/mis_flag=0/mis_flag=1/g' AO22SDFQM2LPA.cir

刪除空白列
sed -i '/^[ ]*$/d' ABC.txt
               ^
刪除包含字串的整行
sed -i '/字串/d' ABC.txt

在第一行後面加入一個字串( 此例中為 0 )
sed -i '1s/$/ 0/' VOLTAGE.*

在搜尋到的字串前/後面加入一行
sed -i '/字串/i要加入的句子' ABC.txt
sed -i '/字串/a要加入的句子' ABC.txt

sed -e '1,10 s/w1/& w2/g' file
把1到10內的w1字串替換成w1 w2字串。

沒有留言:

張貼留言

標籤