答案1
尝试这个:
$ sed 's/\([^@]*\)@\(.*\)\.\([^.]*\)/\2@\3.\1/' file
[email protected]
[email protected]
[email protected]
答案2
对于分隔数据,awk 通常是一个不错的选择。
$ awk -F'[@.]' '{print $2 "@" $3 "." $1}' file
[email protected]
[email protected]
[email protected]