Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Glob for specific length?
- X-seq: zsh-users 15567
- From: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>
- To: Aaron Davies <aaron.davies@xxxxxxxxx>
- Subject: Re: Glob for specific length?
- Date: Mon, 22 Nov 2010 14:59:55 -0500 (EST)
- Cc: "zsh-users@xxxxxxx" <zsh-users@xxxxxxx>
- In-reply-to: <AANLkTimJyakhexAuikdK2hx7TNqAue3HFUJ22j3WB9PL@xxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <AANLkTimJyakhexAuikdK2hx7TNqAue3HFUJ22j3WB9PL@xxxxxxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author