You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mblaze/man/magrep.1

126 lines
2.1 KiB
Groff

.Dd February 15, 2017
8 years ago
.Dt MAGREP 1
.Os
.Sh NAME
.Nm magrep
.Nd print mails matching a pattern
.Sh SYNOPSIS
.Nm
8 years ago
.Op Fl c | Fl q | Fl m Ar max
8 years ago
.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 messages
.Ar msgs
where the value of
.Ar header
matches the POSIX Extended Regular Expression
.Ar regex .
.Pp
8 years ago
If
.Ar header
is empty,
.Nm
will instead match against the Maildir flags of the messages.
.Pp
If
.Ar header
is
.Sq Li "/" ,
.Nm
8 years ago
will instead search the plain text parts of the
.Em body
of the messages.
.Pp
8 years ago
See
.Xr mmsg 7
for the message argument syntax.
If no
.Ar msgs
are passed, and
.Nm
is used interactively,
.Nm
will default to the current sequence.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl a
Search for
.Ar regex
only in all RFC 2822 address parts in
.Ar header .
.It Fl c
Don't print matching messages,
just display the number of matched messages.
.It Fl d
Decode the
.Ar header
according to RFC 2047 first.
.It Fl i
Match
.Ar regex
case insensitively.
8 years ago
.It Fl m Ar max
Do not show more than
.Ar max
matches.
.It Fl o
Print each match,
not the entire line.
This option is ignored if
.Fl c,
.Fl q
or
.Fl v
is specified.
.It Fl p
Print matching messages
.Ar msgs ,
the matching line and the header.
If
.Fl o
is specified each match is printed,
instead of the matching line.
This option is ignored if the
.Fl c,
.Fl q
or
.Fl v
is specified.
8 years ago
.It Fl q
Quiet mode: do not print anything,
quit as soon as possible.
.It Fl v
Invert the match, print (or count) all messages where
.Ar regex
does not match.
.Sh EXIT STATUS
.Nm
returns with exit status 0 if a match was found,
with exit status 1 if no match was found,
and with exit status higher than 1 if an error occurred.
.Sh SEE ALSO
.Xr grep 1 ,
.Xr mmsg 7 ,
.Xr regex 7
.Sh AUTHORS
7 years ago
.An Leah Neukirchen Aq Mt leah@vuxu.org
8 years ago
.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/