Skip navigation.
KDE Developer's Journals

ack, a better grep

brad hards's picture

One of the many things I learned at linux.conf.au was about ack. Thanks to Paul Fenwick for bringing it to our attention. Spend a few minutes with me on this...

If you are a fan of grep (especially with -drecurse), but hate seeing the .svn directories and contents of the object files, you need ack.

Colourised outputs, highlighting, nice organisation, awesome configurability are all bonuses. Even has documentation.

Packages exist for at least Debian and Fedora. Portable (perl), installable using CPAN.

Less to type. What more could you ask for?

Example (without colour, sorry):

bradh-dev@saxicola:~/kde/src/kdesupport/akonadi$ ack AkonadiServer
server/src/akonadi.cpp
53:static AkonadiServer *s_instance = 0;
55:AkonadiServer::AkonadiServer( QObject* parent )
130:AkonadiServer::~AkonadiServer()
134:void AkonadiServer::quit()
187:void AkonadiServer::doQuit()
192:void AkonadiServer::incomingConnection( quintptr socketDescriptor )
201:AkonadiServer * AkonadiServer::instance()
204:        s_instance = new AkonadiServer();
208:void AkonadiServer::startDatabaseProcess()
338:void AkonadiServer::stopDatabaseProcess()
346:void AkonadiServer::serviceOwnerChanged(const QString & name, const QString & oldOwner, const QString & newOwner)

server/src/main.cpp
40:  qDebug( "Shutting down AkonadiServer..." );
42:  Akonadi::AkonadiServer::instance()->quit();
67:    Akonadi::AkonadiServer::instance(); // trigger singleton creation
75:    Akonadi::AkonadiServer::instance()->quit();

server/src/akonadi.h
39:class AKONADIPRIVATE_EXPORT AkonadiServer: public QLocalServer
44:    static AkonadiServer* instance();
46:    AkonadiServer( QObject *parent = 0 );
47:    ~AkonadiServer();

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
fm's picture

great! for opensuse this is

great!

for opensuse this is at http://download.opensuse.org/repositories/home:/pbleser:/Utilities/openSUSE_11.1/noarch/ack-1.86-1.1.noarch.rpm.

ehamberg's picture

excellent!

wow, never heard about it, but this was excellent. thanks for the tip! Smiling

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.