I have users like below in many *sh scripts.
firstname.lastname@example.org email@example.com firstname.lastname@example.org
I want to replace any emails like above with email@example.com in linux.
Any idea will be appreciated ?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
To replace the part before
@ (I think that's what you want), you could use:
sed 's/[^ ]\+@/admin@/g' file
[^ ]\+@match at least one non-whitespace character followed by
gdo the replacement on all matches, even if it occurs more than once on the line.