Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 ?

share|improve this question

2 Answers 2

up vote 3 down vote accepted
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.

share|improve this answer
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. –  Jon Lasser Mar 25 '10 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. –  Chris S Mar 25 '10 at 18:46
    
How can I tell it to search everything from the current directory and beyond? –  Webnet Mar 25 '10 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". –  Bill Weiss Mar 29 '10 at 14:30

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.

share|improve this answer
1  
Or add a redirect to wherever it is you're hosting that image. –  McJeff Mar 25 '10 at 18:02

Your Answer

 
discard

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.