I have the following cases:
[email protected]
[email protected]
[email protected]
I'm trying to convert these to
[email protected]
[email protected]
[email protected]
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?