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


3 Answers 3


As org files are plain text files, we can add tags using a simple approach: query-replace-regexp.

  1. Go to the beginning of the buffer.
  2. Do M-x query-replace-regexp or use the default binding C-M-%.
  3. Enter regexp to match the org headings: ^\*+\s-+.*
  4. To add a tag, you basically append the heading with a space, a : and the tag.
    So the replacement text would be \& :MYTAG. Here \& represents whatever text was matched in the "search" step above.
  5. Now you can review and hit yes only where you want the tag to be appended, or just hit ! 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
  • Thank you, it works. By the way, why do you use -+ in regular expression. It is my first time to see it
    – yuxuan
    Commented Jan 14, 2016 at 20:41
  • @yuxuan \s- is regexp for whitespace. Check out the \scode section here. Commented Jan 14, 2016 at 20:47

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.