On 07/05/13 11:40, Jim Cheetham wrote:
On May 7, 2013 11:33 AM, "Douglas Royds" <[email protected]
<mailto:[email protected]>> wrote:
> On my version of grep, the order of --include and --exclude on the
command line seems to be important. The following command finds hits
in all files, not just in the cmake ones:
Thanks for those observations.
Have you considered evaluating ack as a potential replacement for
grep? It has a better model for selecting what files you need to look
in, as opposed to grep's basic understanding.
http://beyondgrep.com
Nice. When I was web-trawling to try to nut out what was going on with
grep, I came across a lot of replies to "Help me with grep" requests of
the form, "Just use ack".
Under Debian-based distros, it is packaged as ack-grep, and installs
/usr/bin/ack-grep. I have symlinked it, as I have no particular interest
in the Kanji code converter that is packaged and deployed as simply, "ack":
$ sudo ln -s ack-grep /usr/bin/ack
Pleased to see that it supports (almost) all my old favourite grep
options. It also has --smart-case, that I've turned on in my .ackrc.
Under ack 1.96, I can't add the defacto-standard CMakeLists.txt to the
CMake type, as ack insists on adding a leading dot:
$ ack --type-set cmake=CMakeLists.txt,.cmake --help types | ack cmake
--[no]cmake .CMakeLists.txt .cmake
2.4 is not packaged for Ubuntu, so I downloaded it from GitHub (this
sequence installs the head of the dev branch):
$ git clone https://github.com/petdance/ack2.git ~/workspace/ack2
$ cd ~/workspace/ack2
$ cat README.md
...
$ perl Makefile.PL
$ make
$ make test
$ sudo checkinstall
Now installed as /usr/local/bin/ack, and already includes the CMake type:
$ ack --help-types | ack cmake
--[no]cmake CMakeLists.txt; .cmake
My original grep search now becomes simply:
$ ack --cmake pattern
All good.
Douglas.
_______________________________________________
Linux-users mailing list
[email protected]
http://lists.canterbury.ac.nz/mailman/listinfo/linux-users