.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "NOTMUCH-TAG" "1" "Oct 03, 2024" "0.38.3" "notmuch" .SH NAME notmuch-tag \- add/remove tags for all messages matching the search terms .SH SYNOPSIS .sp \fBnotmuch\fP \fBtag\fP [options ...] +<\fItag\fP>|\-<\fItag\fP> [\-\-] <\fIsearch\-term\fP> ... .sp \fBnotmuch\fP \fBtag\fP \fB\-\-batch\fP [\-\-input=<\fIfilename\fP>] .SH DESCRIPTION .sp Add/remove tags for all messages matching the search terms. .sp See \fI\%notmuch\-search\-terms\fP for details of the supported syntax for <\fIsearch\-term\fP>. .sp Tags prefixed by \(aq+\(aq are added while those prefixed by \(aq\-\(aq are removed. For each message, tag changes are applied in the order they appear on the command line. .sp The beginning of the search terms is recognized by the first argument that begins with neither \(aq+\(aq nor \(aq\-\(aq. Support for an initial search term beginning with \(aq+\(aq or \(aq\-\(aq is provided by allowing the user to specify a \(dq\-\-\(dq argument to separate the tags from the search terms. .sp \fBnotmuch tag\fP updates the maildir flags according to tag changes if the \fBmaildir.synchronize_flags\fP configuration option is enabled. See \fI\%notmuch\-config\fP for details. .sp Supported options for \fBtag\fP include .INDENT 0.0 .TP .B \-\-remove\-all Remove all tags from each message matching the search terms before applying the tag changes appearing on the command line. This means setting the tags of each message to the tags to be added. If there are no tags to be added, the messages will have no tags. .UNINDENT .INDENT 0.0 .TP .B \-\-batch Read batch tagging operations from a file (stdin by default). This is more efficient than repeated \fBnotmuch tag\fP invocations. See \fI\%TAG FILE FORMAT\fP below for the input format. This option is not compatible with specifying tagging on the command line. .UNINDENT .INDENT 0.0 .TP .B \-\-input= Read input from given file, instead of from stdin. Implies \fB\-\-batch\fP\&. .UNINDENT .SH TAG FILE FORMAT .sp The input must consist of lines of the format: .sp +<\fItag\fP>|\-<\fItag\fP> [...] [\-\-] <\fIquery\fP> .sp Each line is interpreted similarly to \fBnotmuch tag\fP command line arguments. The delimiter is one or more spaces \(aq \(aq. Any characters in <\fItag\fP> \fBmay\fP be hex\-encoded with %NN where NN is the hexadecimal value of the character. To hex\-encode a character with a multi\-byte UTF\-8 encoding, hex\-encode each byte. Any spaces in \fBmust\fP be hex\-encoded as %20. Any characters that are not part of <\fItag\fP> \fBmust not\fP be hex\-encoded. .sp In the future tag:\(dqtag with spaces\(dq style quoting may be supported for <\fItag\fP> as well; for this reason all double quote characters in <\fItag\fP> \fBshould\fP be hex\-encoded. .sp The <\fIquery\fP> should be quoted using Xapian boolean term quoting rules: if a term contains whitespace or a close paren or starts with a double quote, it must be enclosed in double quotes (not including any prefix) and double quotes inside the term must be doubled (see below for examples). .sp Leading and trailing space \(aq \(aq is ignored. Empty lines and lines beginning with \(aq#\(aq are ignored. .SS EXAMPLE .sp The following shows a valid input to batch tagging. Note that only the isolated \(aq*\(aq acts as a wildcard. Also note the two different quotings of the tag \fBspace in tags\fP .INDENT 0.0 .INDENT 3.5 .sp .EX +winner * +foo::bar%25 \-\- (One and Two) or (One and tag:winner) +found::it \-\- tag:foo::bar% # ignore this line and the next +space%20in%20tags \-\- Two # add tag \(aq(tags)\(aq, among other stunts. +crazy{ +(tags) +&are +#possible\e \-\- tag:\(dqspace in tags\(dq +match*crazy \-\- tag:crazy{ +some_tag \-\- id:\(dqthis is \(dq\(dqnauty)\(dq\(dq\(dq .EE .UNINDENT .UNINDENT .SH SEE ALSO .sp \fI\%notmuch\fP, \fI\%notmuch\-config\fP, \fI\%notmuch\-count\fP, \fI\%notmuch\-dump\fP, \fI\%notmuch\-hooks\fP, \fI\%notmuch\-insert\fP, \fI\%notmuch\-new\fP, \fI\%notmuch\-reply\fP, \fI\%notmuch\-restore\fP, \fI\%notmuch\-search\fP, \fI\%notmuch\-search\-terms\fP, \fI\%notmuch\-show\fP, .SH AUTHOR Carl Worth and many others .SH COPYRIGHT 2009-2024, Carl Worth and many others .\" Generated by docutils manpage writer. .