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/msed.1

142 lines
2.9 KiB
Groff

8 years ago
.Dd August 1, 2016
.Dt MSED 1
.Os
.Sh NAME
.Nm msed
.Nd manipulate message headers
8 years ago
.Sh SYNOPSIS
.Nm
.Ar script
.Op Ar msgs\ ...
.Sh DESCRIPTION
.Nm
prints the messages
.Ar msgs
with message headers transformed by the commands in
.Ar script .
.Po
8 years ago
See
.Xr mmsg 7
for the message argument syntax.
.Pc
8 years ago
If no
.Ar msgs
are passed,
.Nm
will default to the current message.
.Pp
.Nm
scripts are akin to a subset of
.Xr sed 1
scripts, but optimized for modifying messages.
8 years ago
Note that
.Nm
unfolds and normalizes message headers,
so they may need to be passed through
8 years ago
.Xr mmime 7
to ensure RFC 5322 conformance.
The message body is not affected.
8 years ago
.Pp
.Nm
supports the following commands.
The separators
.Em after
the command letter may be substituted with an arbitrary symbol, just as in
8 years ago
.Xr sed 1 .
Multiple commands can be separated by
.Sq Cm \&; .
8 years ago
.Bl -tag -width Ds
.It Cm \&/ Ns Ar header Ns Cm \&/ Ns Ic a Ns Cm \&/ Ns Ar value Ns Cm \&/
8 years ago
If the header
.Sq Ar header Ns Cm \&:
is not set in the message, add it with the given
8 years ago
.Ar value .
.It Cm \&/ Ns Ar headers Ns Cm \&/ Ns Ic c Ns Cm \&/ Ns Ar value Ns Cm \&/
8 years ago
Change colon-separated headers matching the regular expression
.Ar headers ,
with implicit anchoring to the header name,
to the value given in
.Ar value .
.It Cm \&/ Ns Ar headers Ns Cm \&/ Ns Ic d
8 years ago
Delete colon-separated headers matching the regular expression
.Ar headers ,
with implicit anchoring to the header name.
Use explicit
.Sq Li \&.*
8 years ago
to match arbitrary strings at the beginning or end of the headers.
.Pp
For example,
.Sq Li "/x-.*/d"
will delete all headers starting with
.Sq Li "X-"
.Pq always case insensitive ,
8 years ago
and
.Sq Li "/from:to:cc/d"
will delete the headers
.Sq Li From\&: ,
.Sq Li To\&: ,
8 years ago
and
.Sq Li Cc\&: .
.It Oo Cm \&/ Ns Ar headers Ns Cm \&/ Oc Ns Ic s Ns Cm \&/ Ns Ar regex Ns Cm \&/ Ns Ar replacement Ns Cm \&/ Ns Op Ar flags
8 years ago
Substitute matches of the POSIX Basic Regular Expression
.Ar regex
in headers matching the POSIX Basic Regular Expression
.Ar headers ,
with implicit anchoring to the header name
.Pq or all headers, if omitted ,
8 years ago
with the string
.Ar replacement ,
expanding
.Sq Cm \&&
8 years ago
to the matched string,
and
.Sq Cm \e Ns Ar N
8 years ago
to the
.Ar N Ns
th
sub-expression,
where
.Ar N
is between 1 and 9.
.Pp
If
.Ar flags
contains the letter
.Sq Cm d ,
the header is removed if
.Ar regex
matched.
.Pp
8 years ago
By default, only the first match is replaced, unless
.Ar flags
contains the letter
.Sq Cm g .
.Pp
By default,
.Ar regex
is matched case sensitively, unless
.Ar flags
contains the letter
.Sq Cm i .
.El
.Sh EXIT STATUS
.Ex -std
.Sh SEE ALSO
.Xr sed 1 ,
.Xr mhdr 1 ,
8 years ago
.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 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/