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 ?
Asked
Active
Viewed 579 times
2 Answers
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.

Bill Weiss
- 10,979
- 3
- 38
- 66
-
1I'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? – Ben 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
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.

Jon Lasser
- 970
- 5
- 7