[Geany] Applying sort to grep results
nick.treleaven at xxxxx
Wed Jan 20 17:16:01 UTC 2010
On Thu, 17 Dec 2009 14:02:38 +0100
Milan Babuskov <milan.babuskov at gmail.com> wrote:
> many times I use Geany's "find in files" function to search for some
> string inside directory. The problem is that results are not sorted at
> all (at least, I cannot find a critera: it isn't file timestamp or
AFAIU, filenames are sorted so long as you don't use the 'Recurse in
subfolders' option. Maybe this could be fixed, but I'm not sure it's
worth implementing in Geany - see below.
> Would it be possible to sort the result alphabetically (or any other
> way). Just piping grep to sort(1) would be sufficient to me.
Sorting grep's output is not efficient - only the file list needs to be
sorted, and as Enrico mentioned, it's not portable.
The real problem is that grep doesn't support recursive searching well
enough, but you could use the following script for Geany's Grep tool:
Remember to chmod u+x.
This uses ack* and (as of today) sorts filenames too.
Ack skips binary and generated files.
More information about the Users