Hi All,
So I have to remove all the @hostnames from a file, the problem is, there are instances where @ is used for other things... For example:
example text:
@This is some text in between some at signs@
@This is some more text@
This is a line that will contain a username and his/her email - me@somehost.com
This is another email line - you@anotherhost.com
I need to remove the text after the @somehost.com and @anotherhost.com but leave the two previous @ bla bla bla @ lines.
Heres what I have tried:
cat * |egrep -v '@.*@'|sed 's/@.*/@REDACTED/'
This kind of works, but I need all the lines intact
sed 's/@.*/@REDACTED/'
This just removed all the test after the @. This would be ok, but we would like to have the other lines if possible - we do just want to secure the file from having hostnames.
Not sure how to accomplish this. Any advice would be appreciated.
Thanks!
Joe