用另一個子字串替換子字串(PCRE sed)

perl -pe"s/foo/bar/g" file.txt

或就地:

perl -i -pe's/foo/bar/g' file.txt

在 Windows 上:

perl -i.bak -pe"s/foo/bar/g" file.txt