(linux常用命令)sed

Mac

1
find ./ -type f -name "*.py" -exec sed -i '' -e 's/foo/bar/' {} \;

Linux

1
find . -type f -name "*baz*" -exec sed -i 's/foo/bar/g' {} +

常见错误:
sed: RE error: illegal byte sequence
导入如下命令,可恢复正常

1
2
export LC_COLLATE='C'
export LC_CTYPE='C'