for i in recordings/longnow/Long_Now*/*.mp3; do # get the filename base=$(basename "$i"); # strip the extension base=${base%.mp3}; printf "${base%%__*}\t" | tr '_' '-'; # name and title without underscores printf "${base#*__}\n" | tr '_' ' '; done