wittyResry / myIssue

My issue mark down^_^ 欢迎吐槽,讨论~~
https://github.com/wittyResry/myIssue/issues
The Unlicense
5 stars 1 forks source link

perl #137

Open wittyResry opened 1 year ago

wittyResry commented 1 year ago
perl -p -i -e 可以写成 perl -pi -e

-e 参数允许执行 Perl 代码
-p 参数确保处理文本的每一行并且将处理后的结果打印出来
-i 参数将修改的结果应用到文件中(所以看不到 -p 打印的内容了)
文本替换

perl -p -i -e "s/str1/str2/g" file
perl -p -i -e 's/special_str1/special_str2/g' file //当有特殊字符要替换时,要用单引号
例如将.lib 'model.lib' ${process}pre 替换为 .lib 'model.lib' ${process}
CMD: perl -p -i -e 's/\$\{process\}pre/\$\{process\}/g' template.sp

包含回车或者特殊字符
perl -pi -e ":s/platforms: \[\]/platforms:\n  - architecture: amd64\n    os: linux\n  - architecture: arm64\n    os: linux/g" */component.yaml