Grep with OR and -v

Posted on 2008-11-03
Last Modified: 2012-08-13
Hi there,

I am trying to grep my access log to remove all MSIE and Mozilla lines..

If I do
bash$ tail -f access.log | grep -v 'MSIE'
then I exclude all MSIE no problem.
but if I change it so
even try both with "(MSIE|Mozilla)"
then it will just show all as usual...
how can I use grep to exclude MSIE and Mozilla
thinking about it now... the | = or so that with -v might be my downfall...
Question by:wildzero
    LVL 84

    Expert Comment

    tail -f access.log | grep -v 'MSIE' |grep -v Mozilla
    LVL 84

    Accepted Solution

    grep -v 'MSIE\|Mozilla'
    egrep -v 'MSIE|Mozilla'
    LVL 10

    Author Closing Comment

    Thanks :-) I was trying to avoid doing two | greps's

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
    Join Greg Farro and Ethan Banks from Packet Pushers ( and Greg Ross from Paessler ( for a discussion about smart network …
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
    Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now