This question already has an answer here:

for i in {1..25}; do cat file$((i)) | sed 's/.*/$((i))/'; done
doesn't print the current value of i but just $((i)). How can I make it print the value of i instead?

marked as duplicate by Rui F Ribeiro, Thomas, Gilles text-processing Dec 30 '18 at 11:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.