1

I have a file containing one word per line.

How can I print out each line in alphabetical order - ie. the first letter of each word decides the order?

1 Answer 1

4

Use sort.

Example file contents:

one
four
eight
nine
thirteen

To sort alphabetically:

sort filename

...which will give:

eight
four
nine
one
thirteen

If you want go from z-a, then use sort -r

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .