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.
所以我对使用 Unix 和所有的东西有点陌生,而且我在做一些练习时遇到了一些麻烦。我需要找到收件箱和发件箱这两个词,并将它们从文件中输出到控制台。但是,文件中还有一堆其他字符串;"收件箱" "INBOX" "Outbox1" "InbOx" "Ibox" "I box"
我一直在阅读 grep 手册并在线搜索,但我仍然不知道如何隔离某些字符以使收件箱和发件箱仅输出。有人可以帮我吗?
如果你想要一个完全匹配的,它是
egrep -w 'Inbox|Outbox' your_input > your_output
或者
grep -w 'Inbox\|Outbox' your_input > your_output