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.
我想要一个终端命令,它会在文本文档中找到模式并输出它们。模式就像prefix[anything]sufix,其中 [anything] 可以是任何文本。我知道grep命令,但不知道如何正确使用它。
prefix[anything]sufix
grep
使用正则-E表达式开关。.*匹配任何东西。
-E
.*
grep -E 'prefix.*suffix' filename