zsh-users
 help / color / mirror / code / Atom feed
From: "Benjamin R. Haskell" <zsh@benizi.com>
To: Aaron Davies <aaron.davies@gmail.com>
Cc: "zsh-users@zsh.org" <zsh-users@zsh.org>
Subject: Re: Glob for specific length?
Date: Mon, 22 Nov 2010 14:59:55 -0500 (EST)	[thread overview]
Message-ID: <alpine.LNX.2.01.1011221452260.2792@hp> (raw)
In-Reply-To: <AANLkTimJyakhexAuikdK2hx7TNqAue3HFUJ22j3WB9PL@mail.gmail.com>

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


  reply	other threads:[~2010-11-22 20:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-22 19:29 Aaron Davies
2010-11-22 19:59 ` Benjamin R. Haskell [this message]
2010-11-23  8:19 ` Frank Terbeck
2010-11-23 15:11   ` Aaron Davies
2010-11-23 15:18     ` Frank Terbeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.01.1011221452260.2792@hp \
    --to=zsh@benizi.com \
    --cc=aaron.davies@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).