When Mac uses sed to replace characters, the backup name must be filled in for security reasons
sed -i 's/a/b/g' test.txt
#报错sed: 1: "test.txt": undefined label 'est.txt'
#修改如下
sed -i '备份文件.bak' 's/a/b/g' test.txt
However, if you update files in batches, it will be more troublesome, so I recommend a gsed software under Mac, which can replace sed
brew install gnu-sed
gsed -i 's/a/b/g' *.txt