Help with either bash or find...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
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

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux