本文根据 Devhints / Perl-pie 翻译。代码示例及版本范围沿用原文。
关于
使用 perl 在多个文件中进行查找和替换。
查找和替换
perl -p -i -e 's/hello/hola/g' *.txt
反向引用
使用 \1 等。
# '@include align-items(center);' => 'align-items: center;'
perl -p -i -e "s/\@include (align-items)\((.*)\);/\1: \2;/g"