Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strip Logs 1

Status
Not open for further replies.

fmuquartet

Programmer
Sep 21, 2006
60
US
Greetings:
Can someone help me with a little script that will strip LINES from my access logs that have a hyphen '-' in the 3rd position?

Example data:
192.168.15.101 - - [02/Jul/2008:10:28:26 -0500] "GET

In this case, I want to remove all LINES in my access log that has '-' in the 3rd position, as this notes an unauthenticated user and is just noise in my logs.


I am being told that possibly sed can help out, but don't know how to approach the problem.

Thanks!
 

Maybe awk would help:
Code:
awk '$3 != "-" {print $0;}' TheLogFile
[3eyes]


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
LKBrwnDBA --
Would have never know it would be this easy, this resolved my problem and has cleaned my logs.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top