Grep Hangs On Sockets

Sorry I haven’t been here in a while; we’ve been extremely busy at work.

Here’s a silly question: suppose I want to “grep” an entire directory. Real life example: we reconfigured our mail server to a different IP address, so I needed to search for each occurrence of the original to make sure they’d all been changed.

A simple


grep -i -l -r "192.168.1.200" *

… works great until it hits a socket. This particular mail server has sockets scattered at random through the directory. When grep hits one of these, it hangs.

I’ve tried every command line option I can think of it to force it to ignore these sockets, but to no avail. Any of you Grep Gurus out there want to give me a hand?

Use find to give grep a list of only files.