1

I'm seeing tons of error logs on our site that are looking for favicon.ico. The favicon is now hosted off of amazon S3 but it appears somewhere we still have a link to the old one that I can't find anywhere (I'm a new employee here so I'm not too familiar with things). How can I do a grep search for favicon.ico that doesn't start with http://s3.amazon.com ?

2 Answers 2

3
cat stuff | grep -v 'http://s3.amazon.com/' | grep favicon.ico 

Explanation: grep -v returns everything that doesn't match. So, throw away everything that has 'http://s3.amazon.com' in it, then look through the remainder for 'favicon.ico'. You could swap those around as you like.

4
  • 1
    I'd do this the other way around (grep for favicon before inverse grep for amazon) as the favicon.ico search will return far fewer items for the inverse grep to process than the other way around. Commented Mar 25, 2010 at 17:59
  • You might want to to grep -vH 'http://s3.amazon.com/' [filenames] | grep favicon.ico as it will give you the name of the file the line was found in. Commented Mar 25, 2010 at 18:46
  • How can I tell it to search everything from the current directory and beyond? Commented Mar 25, 2010 at 20:41
  • grep -rv 'http://s3.amazon.com/' . | grep favicon.ico would do it. That -r and the . means "recursively from some location", . is "here". Commented Mar 29, 2010 at 14:30
0

Many browsers look for favicon.ico files locally, regardless of whether the location is specified in your HTML. Therefore it's quite possibly not an error in your files, and you should simply ignore these errors when they present themselves.

1
  • 1
    Or add a redirect to wherever it is you're hosting that image. Commented Mar 25, 2010 at 18:02

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.