Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a list of 1285 keywords (database object names) that I have compiled into a TXT file; one keyword per line. I would like to search a directory of files (most have a .aspx or .cs extension) using this list of keywords.

My main goal is find out which of the 1285 database objects are being referenced in these files.

Can anyone recommend a tool that could accomplish this? Otherwise, I will just create my own.

Thanks.

share|improve this question

If you are Unix/Linux savvy, you can download GNU utilities for windows (http://unxutils.sourceforge.net/) and use grep.

The "grep -f" flag will take a filename as input, your list of database objects, and search a directory for matches.

For example:

grep -f myDBObjects.txt -r *.aspx

The -f specifies the file name with the patterns to match, one per line, and the -r indicates recursive, to search through all subdirectories from the current directory.

If you install the GNU utilities, don't forget to add the BIN directory to your path in windows.

share|improve this answer
    
Does it list which keywords were found? I don't need a list of the files. – CutRateGamer Jun 1 '10 at 22:10
    
yes, grep will provide you with the name of the file followed by the matching line. Example: >grep blah *.java Test.java: //has blah in this sentance Test2.java: someMethod(String blah) – RussellW Jun 4 '10 at 21:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .