Artificial intelligent assistant

Rename files based on list I have these video files; Fringe.S03E01.mkv Fringe.S03E02.mkv Fringe.S03E03.mkv etc... I also have a .csv text file of the episode's titles; 01,Olivia 02,The Box 03,The Plateau etc... what I am trying to get to is; Fringe.S03E01.Olivia.mkv Fringe.S03E02.The Box.mkv Fringe.S03E03.The Plateau.mkv etc... Ive been trying to figure out the syntax for a bash script using foreach, but not getting any useable results..

fringe_copy(){
local IFS=,
while read num title; do
f=Fringe.S03E$num.mkv
if [ -f "$f" ]; then
echo mv "$f" "${f%.mkv}.$title.mkv"
fi
done
}
fringe_copy

You'll have to remove the `echo` from before `mv` if you're satisfied with the dry run.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 3850f3d0454edc5b9af75962ce720b59