From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13388 invoked by alias); 14 Dec 2005 14:19:26 -0000 Received: (qmail 13342 invoked by uid 22791); 14 Dec 2005 14:19:26 -0000 X-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 14 Dec 2005 14:19:25 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id jBEEJNET012719 for ; Wed, 14 Dec 2005 09:19:23 -0500 Received: from pobox.toronto.redhat.com (pobox.toronto.redhat.com [172.16.14.4]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id jBEEJN119637 for ; Wed, 14 Dec 2005 09:19:23 -0500 Received: from touchme.toronto.redhat.com (IDENT:postfix@touchme.toronto.redhat.com [172.16.14.9]) by pobox.toronto.redhat.com (8.12.8/8.12.8) with ESMTP id jBEEJMN8002244 for ; Wed, 14 Dec 2005 09:19:22 -0500 Received: from tooth.toronto.redhat.com (tooth.toronto.redhat.com [172.16.14.29]) by touchme.toronto.redhat.com (Postfix) with ESMTP id BD25080032B for ; Wed, 14 Dec 2005 09:19:22 -0500 (EST) Received: from tooth.toronto.redhat.com (IDENT:tKI7ymM8cMy+zlwdJSpsMNq2syl1oirH@localhost [127.0.0.1]) by tooth.toronto.redhat.com (8.12.8/8.12.8) with ESMTP id jBEEJMuI016079 for ; Wed, 14 Dec 2005 09:19:22 -0500 Received: (from fche@localhost) by tooth.toronto.redhat.com (8.12.8/8.12.8/Submit) id jBEEJMbv016077 for systemtap@sources.redhat.com; Wed, 14 Dec 2005 09:19:22 -0500 Date: Wed, 14 Dec 2005 17:08:00 -0000 From: "Frank Ch. Eigler" To: systemtap@sources.redhat.com Subject: Re: sorting Message-ID: <20051214141921.GA16055@redhat.com> References: <20051213211627.2051.hunt@redhat.com> <20051214022248.15955.qmail@sourceware.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051214022248.15955.qmail@sourceware.org> User-Agent: Mutt/1.4.1i Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2005-q4/txt/msg00433.txt.bz2 Hi - weikong wrote: > Some time what I want to sort is not the value, but some key. > How? can? Yes. As the man page points out, you can put the "+" or "-" sorting directive on an index in the foreach loop: foreach ([a,b-] in arr) { } Then the iteration will be in decreasing order of the second key. - FChE