如果我想用grep来搜索一个词的出现在一个文件中我使用搜索多个单词在文件
grep token file
什么,如果我想搜索线路,其中包含多个令牌
psuedo code: grep "token1 and token2" file
这个怎么办?
如果我想用grep来搜索一个词的出现在一个文件中我使用搜索多个单词在文件
grep token file
什么,如果我想搜索线路,其中包含多个令牌
psuedo code: grep "token1 and token2" file
这个怎么办?
来头脑最简单的事情是
grep token1 file | grep -h token2
试试这个:
grep token1 file | grep token2
grep的不具有AND运算符,你可以AWK改用:
awk '/token1/ && /token2/' file