Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: executing commands in directories containing specific files



On 12/02/14 14:17, Philip Dexter wrote:
> On Tue, Feb 11, 2014 at 7:35 PM, Jan Larres <jan@xxxxxxxxxxxxxx> wrote:
>> On 12/02/14 13:11, Leonardo Barbosa wrote:
>>> 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?
>>
>> find $HOME -type f -name '*.tex' -exec rm {} \;
>>
> That won't get the aux files

Oh, whoops. I missed the differing extensions. In that case your
solution is probably best, except without removing the tex files
themselves:

  for f in $HOME/**/*.tex; do rm ${f:r}.aux; done

Jan



Messages sorted by: Reverse Date, Date, Thread, Author