* grep and sort
@ 2010-08-15 14:29 Antony
2010-08-15 14:58 ` David Kastrup
2010-08-16 9:22 ` Antony
0 siblings, 2 replies; 4+ messages in thread
From: Antony @ 2010-08-15 14:29 UTC (permalink / raw)
To: help-gnu-emacs
Hi
I'd like to find and sort all lines that contain 'TODO:'
Sorting needs to be based on content and ignore filename
rgrep works except for the sorting part
The results should be in a grep like buffer so I can click on them
If I can get some basic elisp code for this, that would be nice.
I don't know how to modify the regrep command.
Any pointers?
-Antony
PS:
Reason for sorting
I follow my TODO with a space and two digit number like TOOD: 01 or
TODO: 80 with the numbers representing priority. This has worked very
well as a task management mechanism for me in eclispe and visual studio.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: grep and sort
2010-08-15 14:29 grep and sort Antony
@ 2010-08-15 14:58 ` David Kastrup
2010-08-16 9:22 ` Antony
1 sibling, 0 replies; 4+ messages in thread
From: David Kastrup @ 2010-08-15 14:58 UTC (permalink / raw)
To: help-gnu-emacs
Antony <spam+lisp_dot_linux@gmail.com> writes:
> I'd like to find and sort all lines that contain 'TODO:'
> Sorting needs to be based on content and ignore filename
>
> rgrep works except for the sorting part
> The results should be in a grep like buffer so I can click on them
>
> If I can get some basic elisp code for this, that would be nice.
> I don't know how to modify the regrep command.
>
>
> Any pointers?
grep ... | sort -t : -k 2
--
David Kastrup
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: grep and sort
2010-08-15 14:29 grep and sort Antony
2010-08-15 14:58 ` David Kastrup
@ 2010-08-16 9:22 ` Antony
[not found] ` <i4b4o3$e53$1@speranza.aioe.org>
1 sibling, 1 reply; 4+ messages in thread
From: Antony @ 2010-08-16 9:22 UTC (permalink / raw)
To: help-gnu-emacs
On 8/15/2010 7:29 AM, Antony wrote:
> Hi
>
> I'd like to find and sort all lines that contain 'TODO:'
> Sorting needs to be based on content and ignore filename
>
> rgrep works except for the sorting part
> The results should be in a grep like buffer so I can click on them
>
> If I can get some basic elisp code for this, that would be nice.
> I don't know how to modify the regrep command.
>
Let me try rephrasing
I'd like something like
(defun aas-show-todo ()
(interactive)
(grep "-nH -r -i -e 'TODO: ' ~/git/src | sort -t : -k 2"))
then do
M-x aas-show-todo
and have it show me matching lines sorted appropriately in a grep buffer
such that clicking on them takes me to the appropriate file/linenumber
The above code does not work, but hopefully makes my intention more clear
I looked at
http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/progmodes/grep.el
Couldn't find anything to help.
-Antony
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: grep and sort
[not found] ` <i4b4o3$e53$1@speranza.aioe.org>
@ 2010-09-05 2:27 ` David Combs
0 siblings, 0 replies; 4+ messages in thread
From: David Combs @ 2010-09-05 2:27 UTC (permalink / raw)
To: help-gnu-emacs
Not as a solution to this problem, but related to using
grep and getting an *Occur* like buffer.
Say I want to do a grep-like operation, but then
further filter it or process it in some way,
and M-x grep doesn't do just what I want.
Add in that I'm doing this on more than one file,
but want to be able to click-then-be-taken-to
in one long file. Well, like this:
So, I use the grep *program*,
egrep -n -H regexp file file file ... > loc.txt
and maybe in that, for easier viewing, I upper-case
some words, like print --> PRINT, etc.
Now, that -H gave me the filenames:
foo.txt:480:Hello there
foo.txt:9010:what are you doing here?
bar.txt:22:yada yada here yada
...
etc.
That's what's in loc.txt.
THEN, in emacs, I do M-x get
and instead of filling in a regexp or whatever,
I give it this string: cat loc.txt
Works like a charm!
David
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-09-05 2:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-15 14:29 grep and sort Antony
2010-08-15 14:58 ` David Kastrup
2010-08-16 9:22 ` Antony
[not found] ` <i4b4o3$e53$1@speranza.aioe.org>
2010-09-05 2:27 ` David Combs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).