I have a bunch of text of the form
grid = par1.grid;
M3d = par1.M3d;
alpha = par1.alpha;
gamma = par1.gamma;
and I want to transpose each line so the stuff to the right of the equals sign is now to the left of the equals sign and visa versa. So the text above would look as follows.
par1.grid = grid;
par1.M3d = M3d;
par1.alpha = alpha;
par1.gamma = gamma;
Is there an easy way to do this in emacs? I have figured out how to transpose words, but that doesn't seem like quite what I am looking for.
Edit: I am in matlab mode.
Use C-M-%
(a.k.a. M-x
query-replace-regexp
) with regexp \(.*\) = \(.*\);
and replacement \2 = \1;
.