[Gllug] A command to repeat a function for each file

Richard Cohen richard at vmlinuz.org
Thu Feb 14 20:51:30 UTC 2002


On Thu, 14 Feb 2002, Nick Hill wrote:

> I am looking for a command to repeatedly run sox for each file matching a wildcard.
>
> Eg
> if function is foobar and input file is %1 and output file name is %2
>
> foobar 'sox %1 -r 11025 %2 resample' *.wav *11025.wav
>
> so that each file.wav gets re-sampled and written as file11025.wav
>
> Any ideas?
>
> It could possibly be written as a shell script but this would be wasteful
> if a command exists to do something similar already.

I'd just do this as a one-line 'script' at the command-line:

for i in <foo> ; do <bar> ; done

You don't lose anything by doing it as a 'script', and it works... :-)

> Regards
>
>
> Nick.

Cheers
Richard


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list