I have this regex that works fine enough for my purposes for identifying emails in CSVs within a directory using grep
on Mac OS X:
grep --no-filename -E -o "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+\b" *
I've tried to get this working with sed so that I can replace the emails with foo@bar.baz
:
sed -E -i '' -- 's/\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+\b/foo@bar.baz/g' *
However, I can't seem to get it to work. Admittedly, sed
and regex are not my strong points. Any ideas?