June 3, 2009

Find a string in files (using grep easily)

Here's a quick command for a quite common problem:

Is there a way to find a text string inside a bunch of files in a dir ?

Sure it is, here's one :

grep 'MyCoolString' /my/preferred/directory/*

Searches "MyCoolString" inside the specified path and willcard, or if you prefer to ignore case take a look at:

grep -i 'mycoolstring' /my/preferred/directory/*

Easy isn't it ?

Obviously this is not the only method but it's my preferred one, easy syntax, easy to remember, glad to see your comments or alternative methods for this task

Hope it helps



Click Here!