grepコマンドでのAND検索は、パイプで検索文字列を追加。
OR検索は、検索文字列の間に「\|」を入れること。
# Apacheのアクセスログから「feed」を含む文字列を参照 cat /var/log/httpd/access_log |grep "feed" #上記のログを、検索文字列「feed」「403」でAND検索 cat /var/log/httpd/access_log | grep "feed" | grep "403" #上記のログを、検索文字列「feed」「403」でOR検索 cat /var/log/httpd/access_log | grep "feed\|403"
コメント