1 <h1>NOTMUCH-TAG(1)</h1>
5 notmuch-tag - add/remove tags for all messages matching the search
11 <b>notmuch</b> <b>tag</b> [options ...] +<<u>tag</u>>|-<<u>tag</u>> [--] <<u>search-term</u>> ...
13 <b>notmuch</b> <b>tag</b> <b>--batch</b> [--input=<<u>filename</u>>]
18 Add/remove tags for all messages matching the search terms.
20 See <a href='../notmuch-search-terms-7/'>notmuch-search-terms</a>(7) for details of the supported syntax for
21 <<u>search-term</u>>.
23 Tags prefixed by '+' are added while those prefixed by '-' are removed.
24 For each message, tag changes are applied in the order they appear on
27 The beginning of the search terms is recognized by the first argument
28 that begins with neither '+' nor '-'. Support for an initial search
29 term beginning with '+' or '-' is provided by allowing the user to
30 specify a "--" argument to separate the tags from the search terms.
32 <b>notmuch</b> <b>tag</b> updates the maildir flags according to tag changes if the
33 <b>maildir.synchronize</b>_<b>flags</b> configuration option is enabled. See <a href='../notmuch-config-1/'>not‐</a>
34 <a href='../notmuch-config-1/'>much-config</a>(1) for details.
36 Supported options for <b>tag</b> include
39 Remove all tags from each message matching the search terms
40 before applying the tag changes appearing on the command
41 line. This means setting the tags of each message to the
42 tags to be added. If there are no tags to be added, the mes‐
43 sages will have no tags.
46 Read batch tagging operations from a file (stdin by default).
47 This is more efficient than repeated <b>notmuch</b> <b>tag</b> invocations.
48 See <u>TAG</u> <u>FILE</u> <u>FORMAT</u> below for the input format. This option
49 is not compatible with specifying tagging on the command
52 <b>--input=<filename></b>
53 Read input from given file, instead of from stdin. Implies
57 <h2>TAG FILE FORMAT</h2>
59 The input must consist of lines of the format:
61 +<<u>tag</u>>|-<<u>tag</u>> [...] [--] <<u>query</u>>
63 Each line is interpreted similarly to <b>notmuch</b> <b>tag</b> command line argu‐
64 ments. The delimiter is one or more spaces ' '. Any characters in <<u>tag</u>>
65 <b>may</b> be hex-encoded with %NN where NN is the hexadecimal value of the
66 character. To hex-encode a character with a multi-byte UTF-8 encoding,
67 hex-encode each byte. Any spaces in <tag> <b>must</b> be hex-encoded as %20.
68 Any characters that are not part of <<u>tag</u>> <b>must</b> <b>not</b> be hex-encoded.
70 In the future tag:"tag with spaces" style quoting may be supported for
71 <<u>tag</u>> as well; for this reason all double quote characters in <<u>tag</u>>
72 <b>should</b> be hex-encoded.
74 The <<u>query</u>> should be quoted using Xapian boolean term quoting rules:
75 if a term contains whitespace or a close paren or starts with a double
76 quote, it must be enclosed in double quotes (not including any prefix)
77 and double quotes inside the term must be doubled (see below for exam‐
80 Leading and trailing space ' ' is ignored. Empty lines and lines begin‐
81 ning with '#' are ignored.
84 <h3> EXAMPLE</h3>
86 The following shows a valid input to batch tagging. Note that only the
87 isolated '*' acts as a wildcard. Also note the two different quotings
88 of the tag <b>space</b> <b>in</b> <b>tags</b>
91 +foo::bar%25 -- (One and Two) or (One and tag:winner)
92 +found::it -- tag:foo::bar%
93 # ignore this line and the next
95 +space%20in%20tags -- Two
96 # add tag '(tags)', among other stunts.
97 +crazy{ +(tags) +&are +#possible\ -- tag:"space in tags"
98 +match*crazy -- tag:crazy{
99 +some_tag -- id:"this is ""nauty)"""
104 <a href='../notmuch-1/'>notmuch</a>(1), <a href='../notmuch-config-1/'>notmuch-config</a>(1), <a href='../notmuch-count-1/'>notmuch-count</a>(1), <a href='../notmuch-dump-1/'>notmuch-dump</a>(1), <a href='../notmuch-hooks-5/'>not‐</a>
105 <a href='../notmuch-hooks-5/'>much-hooks</a>(5), <a href='../notmuch-insert-1/'>notmuch-insert</a>(1), <a href='../notmuch-new-1/'>notmuch-new</a>(1), <a href='../notmuch-reply-1/'>notmuch-reply</a>(1),
106 <a href='../notmuch-restore-1/'>notmuch-restore</a>(1), <a href='../notmuch-search-1/'>notmuch-search</a>(1), <a href='../notmuch-search-terms-7/'>notmuch-search-terms</a>(7), <a href='../notmuch-show-1/'>not‐</a>
107 <a href='../notmuch-show-1/'>much-show</a>(1),
112 Carl Worth and many others
117 2014, Carl Worth and many others