Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: iterating through a hierarchy with a filter
- X-seq: zsh-users 12774
- From: Thor Andreassen <ta@xxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: iterating through a hierarchy with a filter
- Date: Thu, 10 Apr 2008 12:52:45 +0200
- In-reply-to: <DDABD6BC-F3D9-4277-86C1-776B24CB914F@xxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <8BAD0AA6-3B6F-4946-B636-6C16B56A944E@xxxxxxxxx> <200804100851.m3A8pk9S003521@xxxxxxxxxxxxxx> <DDABD6BC-F3D9-4277-86C1-776B24CB914F@xxxxxxxxx>
On Thu, Apr 10, 2008 at 02:03:21AM -0700, Alexy Khrabrov wrote:
>
> On Apr 10, 2008, at 1:51 AM, Peter Stephenson wrote:
[...]
> >for file1 in source/**/*.xml; do
> > file2=dest/${${file1##source/}:r}.txt
> > destdir=${file2:h}
> > [[ -d $destdir ]] || mkdir -p $destdir
> > filter <$file1 >$file2
> >done
[...]
> Well, my hierarchy is a million small files. So I doubt globbing will
> work -- should I try? :)
Doing it as a stream should work, e.g.:
find source/ -iname '*.xml' | while read file1; do
file2=dest/${${file1##source/}:r}.txt
destdir=${file2:h}
[[ -d $destdir ]] || mkdir -p $destdir
filter < $file1 > $file2
done
--
Thor
Messages sorted by:
Reverse Date,
Date,
Thread,
Author