從 marx’s IT experience看到的
常常會用到所以留個備忘
perl -pi -w -e ‘s/search/replace/g;’ *.php
-pi (-p 遞迴執行 -i[ext]複製讀取內容,處理後再覆蓋;如加上[ext],則原文件會備份到filename.ext)
-e (執行某些指令碼)
-w (列出 warning )
案例 取代 *php, *htm 內的
content="text/html; charset=big5″ 改為 content="text/html; charset=utf8″
可以下
perl -pi -w -e ‘s/content="text\/html; charset=big5″/content="text\/html; charset=utf8″/g;’ *.php(*.htm ,relative )
參考