Friday, July 29, 2005

Finding social security numbers on Windows systems

I was looking for a way of finding social security numbers in files, on Windows boxes, and couldn't get the GUI search to do it. Being a command line kind of person, I eventually came up with this gem:

FINDSTR /m /r "...\-..\-...." .\*

which will look in the current directory (use /s to recurse) and print out the names of the files that contain SSN format strings. It works on binary files like .xls and .doc too, not just ASCII.