summary refs log tree commit diff
path: root/man/mpick.1
blob: 69a8e41dbf08320ee3c66363a4601b8b05b0e725 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
.Dd July 27, 2016
.Dt MPICK 1
.Os
.Sh NAME
.Nm mpick
.Nd advanced message filter
.Sh SYNOPSIS
.Nm
.Op Fl T
.Op Fl t Ar test
.Op Ar msglist\ ...
.Sh DESCRIPTION
.Nm
prints all matching messages.
.Pp
If used interactively,
.Nm
will default to the current sequence.
Otherwise,
.Nm
will read filenames from the standard input.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl T
Include whole thread.
.It Fl t Ar test
Only show messages matching the expression
.Ar test ,
see
.Sx TESTS .
.El
.Sh MSGLISTS
.Nm
message lists
.Pq msglist
are mostly compatible with
.Xr mailx 1 .
They are message specifications used as shortened
.Sx TESTS ,
and can include:
.Bl -tag -width Ds
.It Ar n
Message number
.Ar n .
.It Ar n Ns Cm \&: Ns Ar m , Ar n Ns Cm \&- Ns Ar m
An inclusive range of message numbers between
.Ar n
and
.Ar m .
.It Ar address
All messages from
.Ar address .
.It Cm \&/ Ns Ar string
All messages with
.Ar string
in the subject line
.Pq case ignored .
.It Cm \&: Ns Ar c
All messages of type
.Ar c ,
where
.Ar c
shall be one of:
.Bl -tag -width Ds
.It Cm D
Draft messages.
.It Cm P
Passed
.Pq resent, forwarded or bounced
messages.
.It Cm R
Replied messages.
.It Cm F
Flagged messages.
.It Cm d , Cm T
Deleted messages.
.It Cm n
New messages.
.It Cm o
Old messages.
.It Cm r , Cm S
Read messages.
.It Cm u
Unread messages.
.El
.El
.Sh TESTS
.Nm
tests are given by the following EBNF:
.Bd -literal
<expr>     ::= <expr> || <expr>  -- disjunction
             | <expr> && <expr>  -- conjunction
             | ! <expr>          -- negation
             | ( <expr> )
             | <flagprop>
             | <timeprop> <numop> <dur>
             | <numprop> <numop> <num>
             | <strprop> <strop> <str>
             | prune             -- do not match further messages in thread
             | print             -- always true value

<flagprop> ::= child | draft | flagged | info | new | parent | passed
             | replied  | seen | selected | trashed

<timeprop> ::= atime | ctime | mtime | date

<numprop>  ::= depth | kept | replies | index | size | total

<numop>    ::= <= | < | >= | > | == | = | !=

<dur>      ::= "./path"          -- mtime of relative path
             | "/path"           -- mtime of absolute path
             | "YYYY-MM-DD HH:MM:SS"
             | "YYYY-MM-DD"      -- at midnight
             | "HH:MM:SS"        -- today
             | "HH:MM"           -- today
             | "-[0-9]+d"        -- n days ago at midnight
             | "-[0-9]+h"        -- n hours before now
             | "-[0-9]+m"        -- n minutes before now
             | "-[0-9]+s"        -- n seconds before now
             | [0-9]+            -- absolute epoch time

<num>      ::= [0-9]+ ( c        -- *1
                      | b        -- *512
                      | k        -- *1024
                      | M        -- *1024*1024
                      | G        -- *1024*1024*1024
                      | T )?     -- *1024*1024*1024*1024
             | cur               -- index of cur message

<strprop>  ::= from | subject | to
             | <str>             -- header name

<strop>    ::= == | = | !=       -- string (in)equality
             | ===    | !===     -- case insensitive string (in)equality
             | ~~     | !~~      -- glob (fnmatch)
             | ~~~    | !~~~     -- case insensitive glob (fnmatch)
             | =~     | !=~ | !~ -- POSIX Extended Regular Expressions
             | =~~    | !=~~     -- case insensitive POSIX Extended Regular Expressions

<str>      ::= " ([^"] | "")+ "  -- use "" for a single " inside "
             | $[A-Za-z0-9_]+    -- environment variable
.Ed
.Sh EXIT STATUS
.Ex -std
.Sh EXAMPLES
You can pick mails to move them into another
.Dv maildir .
.Pp
.Dl mv $(mlist ./INBOX | mpick -t 'from =~ \&"@github\&"') ./github/cur
.Pp
Or you can use
.Nm
to pick mails from the current sequence.
.Pp
.Dl mpick -t 'subject =~~ \&"mblaze\&"' | mscan
.Pp
A more advanced
.Nm
expression to pick mails in a certain time span,
which are flagged as replied or not seen.
.Bd -literal -offset indent
mpick -t 'date >= \&"2016-01-01\&" && date < \&"2017-01-01\&" && (replied || !seen)'
.Ed
.Pp
And to find other mblaze users.
.Pp
.Dl mpick -t '"User-Agent" =~~ \&"mblaze\&"' | mscan
.Sh SEE ALSO
.Xr lr 1 ,
.Xr mailx 1
.Sh AUTHORS
.An Leah Neukirchen Aq Mt leah@vuxu.org
.An Duncan Overbruck Aq Mt mail@duncano.de
.Sh LICENSE
.Nm
is in the public domain.
.Pp
To the extent possible under law,
the creator of this work
has waived all copyright and related or
neighboring rights to this work.
.Pp
.Lk http://creativecommons.org/publicdomain/zero/1.0/