- Store artist names to multi line text variable.
export list="$(ls *.mp3 | awk '{split($0,a," - "); print a[1]}' | uniq)"
- Check if names correct.
echo $list
- Create named directories from artist names variables.
echo "$list" | while IFS= read -r line ; do mkdir "$line"; done
- Move all mp3 files to their corresponding directories.
echo "$list" | while IFS= read -r line ; do mv $line*.mp3 $line/; done