RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

A Better / More Robust method of searching *.cs file contents

Azzerhoden

Wanderer
A Better / More Robust method of searching *.cs file contents

Windows *Find in Files* is ... spotty (at best) ... when it comes to searching for specific text references in *.cs files.

A better, more robust way of searching can be found by installing Cygwin, which is a Linux-like environment for Windows. You can download it for free from Cygwin Information and Installation

Once installed, open cygwin and cd to your directory. If you are not familiar with Linux this may be intimidating, but it really will find what you are looking for.

For an example, on my flash drive I type the following at the command prompt:
Code:
 cd G: <Enter>
The window will then display:
Code:
my_login@my_computer_name /cygwin/g
I then change directory to the location of my RunUO installation.
Code:
cd RunUO\ RC2
You can either escape the space in the file name with a backslash '\', or by putting the entire filename in double quotes.
Code:
cd "RunUO RC2"

Now that you are in the directory you want to begin your search, enter in the entire line of text, all on 1 line:
Code:
find ./ -exec grep -l "the text you are searching for" {} \;

In essence you are searching from the current folder, the contents of every file (even in sub-folders) for the exact string of text you are looking for. As a side note, you can perform a case insensitive search by adding a -i alongside the -l (lower case L) to the grep command. (Or, to provide an example)

Code:
find ./ -exec grep -i -l "the text you are searching for" {} \;

NOTE: the text must be entered exactly! Linux/UNIX is case sensitive. -i is not the same as -I. :)
 
Top