I have the following cases:
firstname.lastname@example.org email@example.com firstname.lastname@example.org
I'm trying to convert these to
email@example.com firstname.lastname@example.org email@example.com
So it should remove everything from the first '_' (including it) to the @ (not including that).
I have something, but it doesn't really work correctly:
Based on this thread: Cut based on Two Delimiters at one go, and this U&L Q&A: Splitting string by the first occurrence of a delimiter.
sed 's/^.*_\([^ ]*\) .*\@\([^$]*\)$/\1 \2/' infile
But no luck. Anyone want to take a chime at it?