1
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, big dogs, cats
pineapple, banana, orange
yellow, red, blue, green
silver, gold, platinum
delphi, java, c++, visual basic
An item here is defined by the piece of text: 1. starting in the beginning of a line and ended right before the first comma; 2. surrounded by commas and 3. starting right after the last comma and ending ate the end of line. So spaces are not separators, as in "big dogs" forms a single item.
I want to sort each line alphabetically, WITHOUT changing line order.
My desired result would be:
big dogs, cats, 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!
What operating system are you using? – Daniel Beck – 2012-10-19T17:06:20.903
I'm using Windows 7, but I have cygwin installed also. – Daniel – 2012-10-19T17:06:59.013
Anybody can help me? – Daniel – 2012-10-23T21:46:41.553
Do you know any programming languages? Perl or Python could do this pretty easily. Perl would be my first choice, this being a text processing task. Any programming language could do it, though. Shouldn't take more than half an hour at very most. – Jack M – 2012-10-23T21:49:48.267
I code in java and delphi, but I feel python or perl would give me these results easily, wouldn't they? – Daniel – 2012-10-23T23:25:10.347