Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的文件中有很多以下常规部分,我想在 perl 中删除这个词,TEST1我TEST2 该怎么做?
TEST1
TEST2
TEST1 xxx xxx xxx TEST2 ggg TEST1 xxx xxx TEST2 ggg
使用触发器运算符:
$ perl -ne 'print unless /^TEST1$/ .. /^TEST2/' <<'END' TEST1 xxx xxx xxx TEST2 ggg TEST1 xxx xxx TEST2 ggg END
输出:
ggg ggg