Zsh Mailing List Archive
Messages sorted by:
Re: How much of it is zsh?
- X-seq: zsh-users 14968
- From: Stephane Chazelas <stephane_chazelas@xxxxxxxx>
- To: Nadav Har'El <nyh@xxxxxxxxxxxxxxxxxxx>
- Subject: Re: How much of it is zsh?
- Date: Wed, 24 Mar 2010 19:49:31 +0000
- Cc: zzapper <david@xxxxxxxxxx>, zsh-users@xxxxxxx
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent; b=iTClQaa7uvIuvl18IFF8cb5bCdHJkdKgpiKP+tKn7o0dDF5xpbua8K/qFdMLFg5vQsUNtLbEma012kh9xNKHfYkDtDW4nXVpJ7uigR5tYTAzmLULNXPqtuUJMqJ8YmCVPY772StlcpwwE0pj1UqliU/58Rbxme3ds1U5J7lKNvs= ;
- In-reply-to: <20100324120359.GA29984@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:email@example.com>
- Mail-followup-to: Nadav Har'El <nyh@xxxxxxxxxxxxxxxxxxx>, zzapper <david@xxxxxxxxxx>, zsh-users@xxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <Xns9D456D0F33B88zzappergmailcom@xxxxxxxxxxxx> <20100324120359.GA29984@xxxxxxxxxxxxxxxxxxxxxxxxxx>
2010-03-24 14:03:59 +0200, Nadav Har'El:
> You're right that the two commands
> egrep -R something dir
> egrep something dir/**/*
> basically end up doing the same thing, but I don't see why you should
> consider this a problem. By the way, if you're curious, there's actually
> a subtle difference between the way these two work. Like I said, the shell's
> globbing is always done in advance. So if dir has a million files under it,
> this will expand into a command with a million arguments - which on some
> system can be a problem (too much memory used, or command too long).
> On the other hand, egrep -R finds the files recursively one by one, and
> never needs to hold the whole list of files in memory.
There are a few other differences:
- grep -R (at least the GNU variant as probably found on
cygwin) will follow symbolic links when descending directories
(use dir/***/* to achieve the same with zsh).
- **/* will ommit dot files and do dirs, use **/*(D) to avoid
- **/* also sorts the list of files which adds some more overhead but
produces a more reproducible outcome. Use **/*(oN) to prevent
egrep -R something dir
would be more like:
egrep something dir/***/*(DoN)
grep -E something dir/**/*(.DoN)
would probably be more what you'd want though.
Messages sorted by: