Re: Transform part of a message body
[email protected] (Dale R. Worley) Thu, 21 Jan 2016 10:13:54 -0500
| Newsgroups | gmane.mail.procmail |
|---|---|
| Message-ID | <[email protected]> |
"@lbutlr" <[email protected]> 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,} "\(.\)" 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