On 2019-01-23 at 12:22 -0800, John Kitchin <jkitc...@andrew.cmu.edu> 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.


Reply via email to