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

149 lines
2.3 KiB
Groff

.Dd September 10, 2018
8 years ago
.Dt MAGREP 1
.Os
.Sh NAME
.Nm magrep
.Nd search messages matching a pattern
8 years ago
.Sh SYNOPSIS
.Nm
.Op Fl c | Fl h | Fl o | Fl p | Fl q | Fl m Ar max
8 years ago
.Op Fl v
.Op Fl i
.Op Fl l
8 years ago
.Op Fl a | Fl d
.Ar header Ns Cm \&: Ns Ar regex
8 years ago
.Op Ar msgs\ ...
.Sh DESCRIPTION
.Nm
prints the names of files from the specified
8 years ago
.Ar msgs
if the value of
8 years ago
.Ar header
matches the POSIX Extended Regular Expression
.Ar regex .
.Po
See
.Xr mmsg 7
for the message argument syntax.
.Pc
.Pp
8 years ago
If
.Ar header
is empty,
.Nm
matches against the maildir flags of
.Ar msgs .
8 years ago
.Pp
If
.Ar header
is
.Sq Cm \&* ,
.Nm
searches for the pattern in any header.
.Pp
If
.Ar header
is
.Sq Cm \&/ ,
.Nm
searches any plain text parts of the
.Ar msgs
body.
.Pp
8 years ago
If no
.Ar msgs
are specified and
8 years ago
.Nm
is used interactively,
the current sequence will be searched.
8 years ago
.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.
8 years ago
.It Fl c
Only print a count of matching headers.
If
.Fl v
is specified,
count non-matching headers instead.
8 years ago
.It Fl d
Decode the
.Ar header
according to RFC 2047 prior to searching.
.It Fl h
Like
.Fl p
but do not print the file name.
8 years ago
.It Fl i
Match
.Ar regex
case insensitively.
.It Fl l
Only search a message until a match has been found.
8 years ago
.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.
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 files where
8 years ago
.Ar regex
does not match.
.El
8 years ago
.Sh EXIT STATUS
The
8 years ago
.Nm
utility exits 0 on success, 1 if no match was found
and >1 if an error occurs.
8 years ago
.Sh SEE ALSO
.Xr grep 1 ,
.Xr mmsg 7 ,
.Xr regex 7 /
.Xr re_format 7
8 years ago
.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/