2017-02-15 17:28:42 +00:00
|
|
|
.Dd February 15, 2017
|
2016-08-02 14:02:29 +00:00
|
|
|
.Dt MAGREP 1
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm magrep
|
2018-01-28 23:32:43 +00:00
|
|
|
.Nd search messages matching a pattern
|
2016-08-02 14:02:29 +00:00
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
2016-08-02 15:03:32 +00:00
|
|
|
.Op Fl c | Fl q | Fl m Ar max
|
2016-08-02 14:02:29 +00:00
|
|
|
.Op Fl v
|
|
|
|
.Op Fl i
|
|
|
|
.Op Fl a | Fl d
|
2017-05-17 12:05:18 +00:00
|
|
|
.Ar header Ns Cm \&: Ns Ar regex
|
2016-08-02 14:02:29 +00:00
|
|
|
.Op Ar msgs\ ...
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
.Nm
|
2017-06-30 11:11:08 +00:00
|
|
|
prints the names of files from the specified
|
2016-08-02 14:02:29 +00:00
|
|
|
.Ar msgs
|
2017-06-30 11:11:08 +00:00
|
|
|
if the value of
|
2016-08-02 14:02:29 +00:00
|
|
|
.Ar header
|
|
|
|
matches the POSIX Extended Regular Expression
|
|
|
|
.Ar regex .
|
2018-01-28 23:32:43 +00:00
|
|
|
.Po
|
|
|
|
See
|
|
|
|
.Xr mmsg 7
|
|
|
|
for the message argument syntax.
|
|
|
|
.Pc
|
2016-08-02 14:28:35 +00:00
|
|
|
.Pp
|
2016-08-02 14:02:29 +00:00
|
|
|
If
|
|
|
|
.Ar header
|
|
|
|
is empty,
|
|
|
|
.Nm
|
2018-01-28 23:32:43 +00:00
|
|
|
matches against the maildir flags of
|
2017-06-30 11:11:08 +00:00
|
|
|
.Ar msgs .
|
2016-08-02 14:02:29 +00:00
|
|
|
.Pp
|
2016-08-02 14:28:35 +00:00
|
|
|
If
|
|
|
|
.Ar header
|
|
|
|
is
|
2017-05-17 12:05:18 +00:00
|
|
|
.Sq Cm \&/ ,
|
2016-08-02 14:28:35 +00:00
|
|
|
.Nm
|
2017-06-30 11:11:08 +00:00
|
|
|
searches any plain text parts of the
|
|
|
|
.Ar msgs
|
|
|
|
body.
|
2016-08-02 14:28:35 +00:00
|
|
|
.Pp
|
2016-08-02 14:02:29 +00:00
|
|
|
If no
|
|
|
|
.Ar msgs
|
2018-01-28 23:32:43 +00:00
|
|
|
are specified and
|
2016-08-02 14:02:29 +00:00
|
|
|
.Nm
|
|
|
|
is used interactively,
|
2017-06-30 11:11:08 +00:00
|
|
|
the current sequence will be searched.
|
2016-08-02 14:02:29 +00:00
|
|
|
.Pp
|
|
|
|
The options are as follows:
|
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It Fl a
|
|
|
|
Search for
|
|
|
|
.Ar regex
|
2017-06-30 11:11:08 +00:00
|
|
|
in RFC 2822 address
|
|
|
|
.Ar header
|
|
|
|
parts only.
|
2016-08-02 14:02:29 +00:00
|
|
|
.It Fl c
|
2017-06-30 11:11:08 +00:00
|
|
|
Only print a count of matching messages.
|
2016-08-02 14:02:29 +00:00
|
|
|
.It Fl d
|
|
|
|
Decode the
|
|
|
|
.Ar header
|
2017-06-30 11:11:08 +00:00
|
|
|
according to RFC 2047 prior to searching.
|
2016-08-02 14:02:29 +00:00
|
|
|
.It Fl i
|
|
|
|
Match
|
|
|
|
.Ar regex
|
|
|
|
case insensitively.
|
2016-08-02 15:03:32 +00:00
|
|
|
.It Fl m Ar max
|
|
|
|
Do not show more than
|
|
|
|
.Ar max
|
|
|
|
matches.
|
2017-02-15 17:28:42 +00:00
|
|
|
.It Fl o
|
2017-06-30 11:11:08 +00:00
|
|
|
Print each match only,
|
2017-02-15 17:28:42 +00:00
|
|
|
not the entire line.
|
|
|
|
This option is ignored if
|
2017-05-15 13:08:03 +00:00
|
|
|
.Fl c ,
|
2017-02-15 17:28:42 +00:00
|
|
|
.Fl q
|
|
|
|
or
|
|
|
|
.Fl v
|
|
|
|
is specified.
|
|
|
|
.It Fl p
|
2017-07-02 16:22:51 +00:00
|
|
|
Print the filename,
|
2017-06-30 11:11:08 +00:00
|
|
|
the header and the matching line
|
|
|
|
for each of the matched
|
|
|
|
.Ar msgs .
|
2017-02-15 17:28:42 +00:00
|
|
|
If
|
|
|
|
.Fl o
|
|
|
|
is specified each match is printed,
|
|
|
|
instead of the matching line.
|
2017-06-30 11:11:08 +00:00
|
|
|
This option is ignored if
|
2017-05-15 13:08:03 +00:00
|
|
|
.Fl c ,
|
2017-02-15 17:28:42 +00:00
|
|
|
.Fl q
|
|
|
|
or
|
|
|
|
.Fl v
|
|
|
|
is specified.
|
2016-08-02 14:02:29 +00:00
|
|
|
.It Fl q
|
|
|
|
Quiet mode: do not print anything,
|
|
|
|
quit as soon as possible.
|
|
|
|
.It Fl v
|
2017-06-30 11:11:08 +00:00
|
|
|
Invert the match; print (or count) all files where
|
2016-08-02 14:02:29 +00:00
|
|
|
.Ar regex
|
|
|
|
does not match.
|
2017-05-15 13:08:03 +00:00
|
|
|
.El
|
2016-08-02 14:02:29 +00:00
|
|
|
.Sh EXIT STATUS
|
2017-07-01 16:46:39 +00:00
|
|
|
The
|
2016-08-02 14:02:29 +00:00
|
|
|
.Nm
|
2017-07-01 16:46:39 +00:00
|
|
|
utility exits 0 on success, 1 if no match was found
|
2017-06-30 11:11:08 +00:00
|
|
|
and >1 if an error occurs.
|
2016-08-02 14:02:29 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr grep 1 ,
|
|
|
|
.Xr mmsg 7 ,
|
|
|
|
.Xr regex 7
|
|
|
|
.Sh AUTHORS
|
2017-01-21 16:17:12 +00:00
|
|
|
.An Leah Neukirchen Aq Mt leah@vuxu.org
|
2016-08-02 14:02:29 +00:00
|
|
|
.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/
|