[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Tracking Tags ??
From: |
Ken Mankoff |
Subject: |
Re: [O] Tracking Tags ?? |
Date: |
Wed, 23 Jan 2019 13:57:16 -0800 |
User-agent: |
mu4e 0.9.18; emacs 25.2.2 |
On 2019-01-23 at 12:22 -0800, John Kitchin <address@hidden> wrote...
> I see, that only finds files with the particular tag. I think the goal of
> this is to get a list of all the tags, for use in completion, for example.
I do not think grep is the right solution, but as an ugly hack it can find most
of my tags rather easily. Tags are wrapped in "::" and at the end of the line,
I think. Assuming that, then,
grep -h -E -o "\:.*\:$" *.org | grep -v -E
"PROPERTIES|CATEGORY|END|LOG|STYLE|REPEAT|ID|RESULTS" | tr ':' '\n' | sort |
uniq -c | sort -n
Gives all my tags sorted by usage (I don't use them much) plus a few stray
words others...
Since drawers are usually begin on the 1st column, or within the first few
columns, an alternative to the negative grep could be "cat *.org | cut -c10- |
..." or some other method to skip the first few columns, rather than growing
the negative grep list.
-k.