原文鏈接
語法
sed 's/serach_str/replace_str/g' file_path
在某個文件中查找所有的serach_str並替換為replace_str
| 參數 | 描述 |
|---|---|
| serach_str | 要搜索的字符串 |
| replace_str | 用於替換搜索到的字符串 |
| file_path | 文件路徑 |
用法舉例
sed 's/to/too/g' my.txt
在
my.txt文件中查找所有的to並用too替換掉
sed 's/serach_str/replace_str/g' file_path
在某個文件中查找所有的serach_str並替換為replace_str
| 參數 | 描述 |
|---|---|
| serach_str | 要搜索的字符串 |
| replace_str | 用於替換搜索到的字符串 |
| file_path | 文件路徑 |
sed 's/to/too/g' my.txt
在
my.txt文件中查找所有的to並用too替換掉
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。