From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26648 invoked by alias); 2 Sep 2011 17:03:41 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16303 Received: (qmail 6279 invoked from network); 2 Sep 2011 17:03:30 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110902100313.ZM8455@torch.brasslantern.com> Date: Fri, 02 Sep 2011 10:03:13 -0700 In-reply-to: Comments: In reply to zzapper "listing sub-drectories with most files in" (Sep 2, 3:24pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: listing sub-drectories with most files in MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Sep 2, 3:24pm, zzapper wrote: } } I'm grepping a tree (grep string **/*) and want to list the } subdirectories which have the most files. This is because the grep is } taking ages and I'm hoping I can exclude some of these. This will give you the directories and the count of files in each, in ascending order by number of files: print **/*(/ne{'reply=($REPLY/*(N.)); reply=($#reply\:$REPLY)'}) I'll leave it up to you to decide how you want to make use of that information.