用另一个子字符串替换子字符串(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