shell script question
I am writing a shell script to convert APE to FLAC files for my Grateful Dead live show collection. The problem is, the resulting filename is *.ape.flac, and I want to drop the .ape part somehow....maybe sed? I don't know, I'm a newbie at shell scripting (but not programming)....not looking for a howto...just the best way to accomplish this small task. Thank you.
|
I love shell questions! :)
I think piping the output of an ls into a loop, and sed'ing (as you suggested) the filename is the way to go here. Be careful with typing all the different types of quotes! Code:
ls *.ape.* | while read file; do mv "$file" "`echo $file | sed 's/\.ape\././'`"; done Code:
$ touch "the planet of the apes.ape.flac" Mark. |
Thanks for the quick reply...I'm going to try it right now...
Edit: Success. Thank you very much for the example...I'm going to leave it at that because it works perfectly. In a few I will post the entire shell script for anyone interested. |
Some might find this useful, who knows...
Code:
# ape2flac |
the rename command is simple. i used this for re-encoding some mp3's.
for a in * ; do cd "$a" for i in *.mp3 ; do nice -n 15 lame --preset 150 -b 64 -B 224 --lowpass 17k "$i" rm "$i" done rename .mp3.mp3 .mp3 * cd .. done that was to go through a bunch of directories. rename takes 3 arguments. the text you wish to change, what to change it to, and what files to perform the changes on. so rename ".ape.flac" ".flac" *.flac would be good for you. |
All times are GMT -5. The time now is 01:13 AM. |