Finding various search terms over various files

I love our current third party toolsets. With Resharper, a developer is almost able to navigate through the code base without effort. SQL Server also has a nice set of tooling to be brought off the shelf.

Then you get those really classical tools which just cannot die! They are like god-mode. Sometimes, they even bring new features to it which makes it so much more useful - one which I found pretty useful of late when searching our very large source code base.

Before, I used to fire up a Powershell script like the following (I really enjoy my Powershell scripting):

Get-ChildItem -Filter *.cs -R |
	where {
		$t = (Get-Content ($_.FullName))
		($t -like '*Heat*') -and ($t -like '*Ant*')

But I have also come to love the grep command that Unix platforms offer. And then I made the discovery of git grep; I mean, just compare the following code snippet to the the Powershell like above.

git grep --all-match -e "Ant" -e "Heat" -c

The sample output for git grep puts it into a very nice listing such as the following.


Pretty neat, eh? Well, check out the following reference for more on git grep.

blog comments powered by Disqus