Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know I am able to search for particular keywords in my Apache error_log file by using the grep command:

# grep "favicon.ico" error_log

I am curious though if it is possible to delete/remove any and all lines which contain specific keywords from a file.

I know this won't work but the idea is:

rm -r -f grep "favicon.ico" error_log
share|improve this question
up vote 2 down vote accepted
sed -i '/favicon.ico/d' error_log

But you can get rid of this error appearing in Apache error log by creating an empty favicon.ico file in document root or putting the following in the httpd.conf file:

Redirect 404 /favicon.ico

<Location /favicon.ico>
    ErrorDocument 404 "No favicon"
share|improve this answer
thanks for the help. I did come across the last bit you added but giving several 404 errors seems like it would be bad for page ranking. – JM4 Sep 20 '11 at 16:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.