linux 命令sed命令指定行或匹配行插入行

wangzhensheng發表於2013-01-02
sed -i "231s:.*:hello:g" file #將第231行的所有字元替換為hellosed -i '$d' file #將檔案file的最後一行刪除sed -i "/# hardware ethernet/a${c}" filename # 模式匹配行後匹配行下增加一行,也就是模式匹配後匹配行下插入sed -i "/# hardware ethernet/i${c}" filename # 模式匹配行後匹配行上增加一行,也就是模式匹配後匹配行上插入sed '231ihello' -i file #在第231行上插入hellosed '231ahello' -i file #在第231行上插入hello

Link URL: http://wangzhensheng.itpub.net/post/28229/526324

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8806316/viewspace-752011/,如需轉載,請註明出處,否則將追究法律責任。

相關文章