I want to do simple string replacements with sed to rename some files. Unfortunately it does not work the way I expect. My Input (these files):
Hopefully the answer/post of @jhnc covered all of your question but have a look at this link https://mywiki.wooledge.org/BashPitfalls#for_f_in_.24.28ls_.2A.mp3.29
Now, Another bash approach using an array and a loop.
#!/usr/bin/env bash
shopt -s nullglob
old_files=(*.flac)
new_files=("${old_files[@]#Djrum - Under Tangled Silence - }")
shopt -u nullglob
for i in "${!old_files[@]}"; do
echo mv -v "${old_files["$i"]}" "${new_files["$i"]// /.}"
done
Remove the echo
if you're satisfied with the output/outcome