• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 698
  • Last Modified:

Grep with OR and -v

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
'MSIE|Mozilla'
or
"MSIE|Mozilla"
or
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...
0
wildzero
Asked:
wildzero
  • 2
1 Solution
 
ozoCommented:
tail -f access.log | grep -v 'MSIE' |grep -v Mozilla
0
 
ozoCommented:
or
grep -v 'MSIE\|Mozilla'
or
egrep -v 'MSIE|Mozilla'
0
 
wildzeroAuthor Commented:
Thanks :-) I was trying to avoid doing two | greps's
:-)
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now