How to Delete lines that contain more than three dots in a email before @ character using SED?

Posted on

Problem :

sed '/(.*..*){4,}/d'

The above command mentioned recognizes every DOT in the line…

It is recognizing DOTS after @ sign too.
For example, even this is shown in the result:

Can you help me modify the above command in such a way that only the LEFT side of @ it counts the Multiple DOTS more than 3 and ignores the DOTS after the character @ to right side of the email?


I want the following lines with multiple Dots (3 or more dots) at the LEFT SIDE of @ Character to be only recognizers and deleted from the file.

Any experts, plz suggest me how to modify the above SED command…. Thanks

Solution :

I’m not an expert but, to delete only the 4 dots (or more) patterns at the left side of @ you can simply add @.* at the end of your expression:

sed '/(.*..*){4,}@.*/d'

It means to delete the 4 dots (or more) patterns at the left side of the @ regardless what characters are at the right side.

Leave a Reply

Your email address will not be published. Required fields are marked *