關於 PHP, Linux, Open Source 及個人生活記載的網誌。
RSS icon
  • 用 Sed 做 Search and replace

    Posted on January 26th, 2007 Sam Tang No comments

    在本站另一篇文章介紹了用 Perl 來做 search and replace,而用 sed 也可以做到相同效果,語法為:

    sed -i ‘s/src_str/new_str/g’ filename

    以上指令會將 filename 檔案內的 src_str 替換成 new_str。


    Leave a reply

    *
    To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
    Click to hear an audio file of the anti-spam word