Help with either bash or find...

Daniel B. Thurman dant at cdkkt.com
Fri May 9 15:34:04 UTC 2008


 
It has been awhile since I have been programming in
bash or using the 'find' command and what I am trying
to do is to figure out how to run a command to decode
all my .mpc files into wav as follows:
 
1. Find all MPC files
2. Run each file through mppdec
 
I tried to do this using the 'find' command or even with a
bash script.
 
Using find:
========
find *.mpc -type f -exec mppdec '{}' `echo {} | sed s/.mpc/.wav` \;
** fails because you cannot use {} more than once and also exec is mangled.
 
I recalled using xargs from my past, but cannot remember how to do it.
 
find *.mpc -type f -print0 | xargs ?????
 
Since I had used find/xargs in the past, I have not encountered cases where
filenames can have spaces or other characters embedded, so this is new
for me.  I was not able to get around this issue with find nor with bash scripts.
 
Using bash:
=========
#!/bin/bash
 
for i in $*
do
  F=`echo $i | sed s/.mpc//`
  mppdec $F+".mpc" $F+".wav"
done
 
Any ideas?
 
Thanks-
Dan

No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.524 / Virus Database: 269.23.11/1422 - Release Date: 5/8/2008 5:24 PM
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20080509/22c27945/attachment-0001.htm>


More information about the fedora-list mailing list