我想删除一个设置属性last-lrm-refresh的行(通常是一组设置中的最后一行),其中的输入看起来如下:
dc-version=1.1.16-94ff4df \
cluster-infrastructure=corosync \
maintenance-mode=false \
last-lrm-refresh=1523005561以下内容不起作用。我做错了什么?我已经安装了Perl 5.20.2。
perl -pe 's/ \\\n[ \t]+last-lrm-refresh=[0-9]+//smg' < in.out > out.txt发布于 2018-06-11 08:57:43
您正在读取一行时,一行被定义为以换行符结尾的许多字符,因此\n[ \t]不可能匹配。您可以通过将行的定义更改为整个文件(-0777)来解决此问题。
perl -0777pe 's/ \\\n[ \t]+last-lrm-refresh=[0-9]+//' in.txt > out.txthttps://stackoverflow.com/questions/50793266
复制相似问题