How to use sed regex to replace to words related to each other and one character between them with out change the character and the two words as group like that
ahmed#mohamed ahmed$mohamed ahmed7mohamed I didn't want to replace ahmed only and then replace mohamed only
I used
sed -i 's/ahmed.mohamed/mohamed.ahmed/g' but make all like this I want to keep the character between them.
mohamed.ahmed mohamed.ahmed mohamed.ahmed