Why sed when bash is much better?
Assuming some name nindicates the index you need:
Bash
files=(path/to/files/*pattern*.txt)
echo "${files[n]}"
Posix sh
i=0
for file in path/to/files/*pattern*.txt; do
if [ $i = $n ]; then
break
fi
i=$((i++))
done
echo "$file"
sed , , , , , , .
file=$(printf '%s\n' path/to/files/*pattern*.txt | sed -n "$n"p)
, ls.