From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5263 invoked by alias); 22 Nov 2010 20:00:25 -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: 15567 Received: (qmail 3995 invoked from network); 22 Nov 2010 20:00:24 -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 autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at benizi.com designates 64.130.10.15 as permitted sender) Date: Mon, 22 Nov 2010 14:59:55 -0500 (EST) From: "Benjamin R. Haskell" To: Aaron Davies cc: "zsh-users@zsh.org" Subject: Re: Glob for specific length? In-Reply-To: Message-ID: References: User-Agent: Alpine 2.01 (LNX 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed On Mon, 22 Nov 2010, Aaron Davies wrote: > Is there a glob for files with names of e.g. exactly thirty > characters? sort of the equiv of /^.{30}$/ I don't know whether there's a more concise one, but this works to `ls` the ones that match: ls -l *(e:'[[ $#REPLY == 30 ]] || reply=()':) You could also wrap the expression there into a function: globlen() { [[ $#REPLY == $GLOBLEN ]] || reply=() } GLOBLEN=30 ls -l *(+globlen) More info: man zshall | less +/estring -- Best, Ben