On Tue, 25 Mar 2003 11:31:08 -0800, Patrick Nelson wrote
> Ben Russo wrote:
> > Mike Vanecek wrote:
> > 
> >> Been at it too long, looked in the Reg Expression book, but just can
> >> not see it. Would some kind soul please tell what I am doing wrong
> >> here: 
> >> 
> >> I want to look at messages and ignore lines that have asia1 or asia2
> >> in them: 
> >> 
> >> 
> >> grep -vie '(asia1|asia2)'  /var/log/messages | less
> >> 
> >> I have tried several different combinations, but obviously not the
> >> correct one. 
> >> 
> > 
> > egrep -v "asia1|asia2" /var/log/messages | less
> 
> Although the egrep solution Ben sent works great, just some 
> background because you said you tried do it with grep:
> 
> In grep you can do it also, but you have to escape the control characters
> like:
> 
>   grep -vie '\(asia1\|asia2\)' /var/log/messages | less
> 
> you could also do it a couple of other ways with grep:
> 
>   grep -vie 'asia1\|asia2' /var/log/messages | less
>   grep -vi -e 'asia1' -e 'asia2' /var/log/messages | less
> 
> As far as egrep you could have:
> 
>   egrep -vie '(asia1|asia2)' /var/log/messages | less
>   egrep -vie -e 'asia1' -e 'asia2' /var/log/messages | less

I appreciate the help from you both. Balancing patterns and extended regexp is
a little confusing with regard to knowing when one must escape the control
characters. The more I read about it the less I know ...

It is just what was needed, thank you.




-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to