Imoto 73 Report post Posted March 1 配列(array)に何かのIDと値が入っている場合に、値ベースでソートをしたいという場合は、下記のように配列をリストに変換してから、lsortコマンドを利用することで可能です。 ### 配列の作成(1つ目がID,2つ目が結果値と想定) ### array set sample1 { 100 50.3 101 1.0 102 3.7 103 10.9 104 2.2 105 200.1 106 0.1 107 90.6 } ### 配列からリストに変換 ### set sample2 ""; foreach {ID Val} [array get sample1] { lappend sample2 "$ID $Val"; } ### リストの値部分でソート ### lsort -index 1 -dictionary $sample2; Quote Share this post Link to post Share on other sites