例:替換 test.txt文件中 以"HHH"開頭的行 爲"hello world"
linux:
sed -i "/^HHH/c\hello world" test.txt
-i: 表示直接對文件進行修改
macOS:
sed -i ".bk" "s/^HHH.*/hello world/g" test.txt
匹配行時需要使用正則表達式:'.'表示匹配任意字符,'*'表示匹配零次或多次
使用-i時,必須提供一個備份文件名後綴,即對原文件進行備份;可以輸入空,表示不備份
例:替換 test.txt文件中 以"HHH"開頭的行 爲"hello world"
linux:
sed -i "/^HHH/c\hello world" test.txt
-i: 表示直接對文件進行修改
macOS:
sed -i ".bk" "s/^HHH.*/hello world/g" test.txt
匹配行時需要使用正則表達式:'.'表示匹配任意字符,'*'表示匹配零次或多次
使用-i時,必須提供一個備份文件名後綴,即對原文件進行備份;可以輸入空,表示不備份
軟件截圖: 開始界面: 壓縮界面: 解壓界面: 其它界面: 功能說明:1.如果打開不了軟件,終端中輸入:sudo spctl --master-disable,將安全隱私中的允許任何來源打開