作者: Bruce.
日時: 2008/6/26(02:37)
Bruce.です。

Yささんのやり方がほぼそのまま回答ですが、自分の望むオーダーの
データ列を作ってそれをソートのキーにすればいいです。
元データを改変しちゃうとあとで泣けますから、やらないほうがいいでしょう。

awkだとちょっと厳しいところがありますが、ほかのメジャーなスクリプティング
言語なら、タプルなり多次元配列なりをつかえばすっきりとデータを表せるでしょう。

参考までに、POSIXでは sort order が文字コード順とは限りません。
collation order のデータベースを持っていてそれに従います。
とはいえUnicode(特に5.0とか)でcollation order を全文字に対して
振っていくのは大変でしょうね :)


sort(1) - sort, merge, or sequence check text files (man Pages(1): User Commands)
"Ordering Options

      The default sort order depends on the value of LC_COLLATE. If LC_COLLATE is set to
 C, sorting will be in ASCII order. If LC_COLLATE is set to en_US, sorting is case
 insensitive except when the two strings are otherwise equal and one has an uppercase
 letter earlier than the other. Other locales will have other sort orders."

http://docs.sun.com/app/docs/doc/805-3172/6j31br5no?l=Ja&a=view