Suppose I have hundreds lines of items:
**** aa
**** bb
......
**** cc
I try to multiply set tags. I tried to mark them, and use C-c C-q
, but it didn't works
As org files are plain text files, we can add tags using a simple approach: query-replace-regexp
.
M-x query-replace-regexp
or use the default binding C-M-%
.^\*+\s-+.*
:
and the tag.\& :MYTAG
. Here \&
represents whatever text was matched in the "search" step above.!
if you want to append tags to all the org headings in the buffer.Here's an example org buffer:
* abc
** def
*** ghi
* jkl
** mno
By implementing the above steps and hit !
in that last step, that would get converted to:
* abc :MYTAG
** def :MYTAG
*** ghi :MYTAG
* jkl :MYTAG
** mno :MYTAG
If the headlines you want to change tags for are all located in a contiguous region you can highlight them all, and then use the org-change-tag-in-region
command.
org-agenda
supports many bulk actions. Do an org-agenda
search (C-c a
) that matches the entries you're interested in. In the agenda view use m
to mark them (or *
to mark everything) and the B
to select a bulk action. The +
action will add a tag to each entry.