1

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?

2

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 ., \&.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.