Suppose I have the following text:
int z;
int a;
int c;
int g;
or the following text:
z, a, c, g
How can I sort them to:
int a;
int c;
int g;
int z;
and
a, c, g, z
respectively?
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communitySuppose I have the following text:
int z;
int a;
int c;
int g;
or the following text:
z, a, c, g
How can I sort them to:
int a;
int c;
int g;
int z;
and
a, c, g, z
respectively?
Use M-x sort-lines
for the first example. For the second example, change it into
z, a, c, g,
then use M-x sort-regexp-fields ., \&
.