Search a word or phrase in file(s) in Windows
Posted by Praveen Kumar on December 31, 2009
ack is a tool like grep (command for Unix ), designed for programmers with large trees of heterogeneous source code.
ack is written purely in Perl, and takes advantage of the power of Perl’s regular expressions.
To install the ack
Step 1 – click on http://betterthangrep.com/ack-standalone
Step 2- Copy whole content and save the file lets say ack-standalone.pl
Step3 – we need to run this file with perl. If perl is not install on your system
Stpe -4 Install Strawberry-perl
Step -5 After installing perl compile your ack-standalone.pl with perl
perl c:\Bin\ack-standalone.pl %1 %2 %3 %4 %5
which will create command script in same directory
Step -6 Set the environment path of that command script
Now you are ready to find a word or phrase
C:\> ack —python class or you may use
C:\>ack class —python
class is the word which you are searching in all python file(s) in that directory.
see the File types that ack understands
if your file type is different you may set the type. lets say we want to find a word from kid template file.
create a file with name .ackrc and save it with ackrc extension and type
Now you may find your word/phrase by using
C:\>ack html –kid