procmail
[Top] [All Lists]

Re: Transform part of a message body

2016-01-21 09:46:04


On 21/01/16 17:13, Dale R. Worley wrote:
"@lbutlr" <kremels(_at_)kreme(_dot_)com> writes:
Right, but what I want is to match any lien that contains nothing but
the same characters repeated x times. So I want to match

===============
------------------ 
qqqqqqqqqqqqqqqqqqqq
\\\\\\\\\\\\\\\
/////////////////////////////////
[[[[[[[[[[[[[[[[[[

Etc.

But not match -=-=-=-=-=-=-=-=
Gnu sed (and possibly other sed's) can use this regexp to find the
character sequences you want:

    \(.\)\1{x,}
    Great Dale!   I didn't know that  \n  can be used in the right side of
    the command.  Thanks.   So,  if egrep dosn't like it you can do:

sed  -n  '/^\(.\)\1\{14,\}$/p'


"\(.\)" matches any single (non-newline) character.  "\1" matches
whatever the "\(.\)" matched (which will be one character).  "\1{x,}",
where you replace "x" with a number, means x or more copies of whatever
the "\(.\)" matched.

You probably want to change "." to be more restrictive.  You can write
"[^ ]" to specify that the character may not be a space, for instance.

Dale
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail