Reputation: 65
I have filelists that look like this:
S134_001.wav
S134_002.wav
S134_003.wav
S149_001.wav
S149_002.wav
S149_003.wav
S16_001.wav
S16_002.wav
S16_003.wav
S16_004.wav
S16_005.wav
S16_006.wav
S272_001.wav
S272_002.wav
S272_003.wav
S272_004.wav
S272_005.wav
S272_006.wav
S272_007.wav
S374_001.wav
S396_001.wav
S92_001.wav
And I want to merge S134_001.wav, S134_002.wav, S134_003.wav into S134.wav; S149_001.wav, S149_002.wav and S149_003.wav into S149.wav; and so on ( preferably using sox ).
I also want to delete the original files.
How do I achieve that? Bash is the preferred solution, but any programming language will do. Thanks.
Upvotes: 0
Views: 1471
Reputation: 10139
You can use a for loop like this:
for f in *_001.wav
do
pre=${f%%_001.wav}
# use either cat or sox or whatever works:
#cat "${pre}_"*.wav > "${pre}.wav"
sox -m "${pre}_"*.wav "${pre}.wav"
#rm -rf "${pre}_"*.wav
done
rm
command. Upvotes: 1