Sort each standalone line alphabetically

Posted by Daniel on Super User See other posts from Super User or by Daniel
Published on 2012-10-19T14:52:43Z Indexed on 2012/10/19 17:05 UTC
Read the original article Hit count: 205

Filed under:
|

I want to sort some items in alphabetic order, but in a very specifc way.

I have, for example, the following list, each item separated by comma:

monkeys, dogs, cats
pineapple, banana, orange
yellow, red, blue, green
silver, gold, platinum
delphi, java, c++, visual basic

I want to sort each line alphabetically, WITHOUT changing line order.

My desired result would be:

cats, dogs, monkeys
banana, orange, pineapple
blue, green, red, yellow
gold, platinum, silver
c++, delphi, java, visual basic

My target list has got 3000+ lines, so it should be an automated process.

Thanks!

© Super User or respective owner

Related posts about text

Related posts about sorting