Saturday, December 03, 2011

How annoying is grep ?

So in a directory with only subdirectories, I was doing

grep -r 'Distribution2D' *.cpp

but it didn't work. "Bloody recursive flag is a load of bollocks" I thought to myself. So it turns out it does work but you have to be a bit careful with the file wild cards to make sure it finds everything into which it can recurse.
I.e. this worked fine.

grep -r 'Distribution2D' */*.cpp

Well, f**k me!