discuss: Sorting a dictionary
Subject:
Re: Sorting a dictionary
From:
"Rodolfo J. Paiz" ####@####.####
Date:
17 Jun 2004 14:43:40 -0000
Message-Id: <6.1.1.1.0.20040617084014.0245fef0@mail.simpaticus.com>
At 04:46 6/17/2004, Ruth A. Kramer wrote:
> * Using an editor with regular expressions (or, e.g., sed) convert
>each dictionary entry to a single long line of text by replacing
>"newlines" with some (unused) arbitary text string (like "@@@@" if not
>used elsewhere in your file)
> * Sort the document using standard sort utilities
> * Now "reverse" the first step to convert the single long lines back
>to entries consisting of multiple lines.
An excellent suggestion. Regarding the arbitrary text, I suggest something
that does not allow confusion by repetition; that is, if there were an @
character immediately before a newline or immediately after one, you would
end up with 5 @ signs and then might produce an incorrect result when
changing the 4@ string back into a newline. Using a string without direct
repetition such as "~12345~" would avoid this problem and make the process
safer.
Cheers,
--
Rodolfo J. Paiz
####@####.####
http://www.simpaticus.com