grep help RESOLVED

Jay O'Brien jayobrien at att.net
Wed Jan 5 21:07:35 PST 2005


Tillman Hodgson (and others!)wrote:

> On Wed, Jan 05, 2005 at 08:27:51PM -0800, Jay O'Brien wrote:
> 
>>I want to look at all of the lines in a FreeBSD log file that do not 
>>have an entry from an IP, example 1.2.3.4.  Some basic help with the 
>>use of grep would be appreciated. This is one of the arguments I've 
>>tried that didn't work:
>>
>>grep ^[^1.2.3.4]*$ logfile.log 
> 
> 
> I like `grep -v` for "not" operations. Also note that "." is itself a
> special character.
> 
>   grep -v 1\.2\.3\.4 logfile.log
> 
> might be closer to what you want.
> 
> -T
> 
> 

Thank you! The problem I was having was that I completely overlooked 
the fact that "." needs to be escaped. 

grep -v 1\.2\.3\.4 logfile.log as you suggested, works fine. I'm 
looking at an apache access log, and I want to exclude accesses 
that I made from my IP. 

Thanks, everyone! 

Jay 




More information about the freebsd-questions mailing list