From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20349 invoked by alias); 12 Feb 2014 02:12:00 -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: 18422 Received: (qmail 8887 invoked from network); 12 Feb 2014 02:11:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) 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.2 Date: Tue, 11 Feb 2014 19:53:34 -0600 From: Chris Johnson To: zsh-users@zsh.org Subject: Re: executing commands in directories containing specific files Message-ID: <20140212015333.GA19535@cs2666372x> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-OriginalArrivalTime: 12 Feb 2014 01:53:42.0112 (UTC) FILETIME=[4197EE00:01CF2795] Leonardo Barbosa sent me the following 0.3K: > I'd like to find TeX files (find $HOME -type f -name '*.tex'). Let's say i > have found files a.tex, b.tex, and c.tex. Now, i wanna remove a.aux, b.aux, > c.aux. What's the best way of doing that? There's probably a way to combine the glob and the expansion that I don't know about, but you could do this: texs=(*.tex) && rm ${^texs:r}.aux ${texs:r} strips off the extension giving the Root name of each element in texs. The ${...}.aux causes the .aux to be appended, and the ${^...} causes the appending to happen element-wise. -- Chris Johnson johnch@uwec.edu