summary refs log tree commit diff
path: root/man/magrep.1
blob: b7463262b36a2ae601f02c0cba8c03a9df8c6583 (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
.Dd February 15, 2017
.Dt MAGREP 1
.Os
.Sh NAME
.Nm magrep
.Nd print mails matching a pattern
.Sh SYNOPSIS
.Nm
.Op Fl c | Fl q | Fl m Ar max
.Op Fl v
.Op Fl i
.Op Fl a | Fl d
.Ar header Ns Cm \&: Ns Ar regex
.Op Ar msgs\ ...
.Sh DESCRIPTION
.Nm
prints the names of files from the specified
.Ar msgs
if the value of
.Ar header
matches the POSIX Extended Regular Expression
.Ar regex .
.Pp
If
.Ar header
is empty,
.Nm
matches against the Maildir flags of
.Ar msgs .
.Pp
If
.Ar header
is
.Sq Cm \&/ ,
.Nm
searches any plain text parts of the
.Ar msgs
body.
.Pp
See
.Xr mmsg 7
for the message argument syntax.
If no
.Ar msgs
are specified, and
.Nm
is used interactively,
the current sequence will be searched.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl a
Search for
.Ar regex
in RFC 2822 address
.Ar header
parts only.
.It Fl c
Only print a count of matching messages.
.It Fl d
Decode the
.Ar header
according to RFC 2047 prior to searching.
.It Fl i
Match
.Ar regex
case insensitively.
.It Fl m Ar max
Do not show more than
.Ar max
matches.
.It Fl o
Print each match only,
not the entire line.
This option is ignored if
.Fl c ,
.Fl q
or
.Fl v
is specified.
.It Fl p
Print the filename,
the header and the matching line
for each of the matched
.Ar msgs .
If
.Fl o
is specified each match is printed,
instead of the matching line.
This option is ignored if
.Fl c ,
.Fl q
or
.Fl v
is specified.
.It Fl q
Quiet mode: do not print anything,
quit as soon as possible.
.It Fl v
Invert the match; print (or count) all files where
.Ar regex
does not match.
.El
.Sh EXIT STATUS
The
.Nm
utility exits 0 on success, 1 if no match was found
and >1 if an error occurs.
.Sh SEE ALSO
.Xr grep 1 ,
.Xr mmsg 7 ,
.Xr regex 7
.Sh AUTHORS
.An Leah Neukirchen Aq Mt leah@vuxu.org
.Sh TRIVIA
.Nm
is not called mgrep because many tools with this name already exist.
.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/