Talvez isso ajude você a começar:
#!/bin/bash
for f in *.{mp4,mkv} # no need to use ls.
do
filename=${f##*/} # Use the last part of a path.
extension=${f##*.} # Remove up to the last dot.
filename=${filename%.*} # Remove from the last dot.
dir=${filename#tv} # Remove "tv" in front of filename.
dir=${dir%.*} # Remove episode
dir=${dir%.*} # Remove season
dir=${dir//.} # Remove all dots.
echo "$filename $dir"
if [[ -d $dir ]]; then # If the directory exists
mv "$filename" "$dir"/ # Move file there.
fi
done