我有一些 TCL 文件,其中包含许多这样的行。
unp classification ip-address $env(SOURCE_IP4) mask 255.255.255.0
不幸的是我忘记在最后加上一个词(边缘轮廓)。应该是这样的。
unp classification ip-address $env(SOURCE_IP4) mask 255.255.255.0 edge-profile.
有人可以告诉我如何通过关键字“unp分类ip-address”
搜索该行并在行末尾附加单词“edge-profile”。我需要更改多个文件。一行 perl 或 sed 脚本就很好了。
最佳答案
sed -i '/unp classification ip-address/s/$/ edge-profile/' *.tcl
关于linux - 正则表达式: Search a word and append a new word at the end of the line,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18186989/