Programming in almost language

This is the site where you may share your knowledge and experience to eachother..

  • Categories

  • LinkedIn

  • Tweet Me

  • My footsteps

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

http://damienlearnsperl.blogspot.com/2009/01/install-strawberry-perl-your-windows.html

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 classpython

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

–type-set=kid=.kid

Now you may find your word/phrase by using

C:\>ack html –kid

Reference sites

http://betterthangrep.com/

http://strawberryperl.com/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: