So I am a bit of a noob and have a problem at work. There is a program outputs names in a ie
apple
banana
orange
P1n34ppl3
The problem is that the files that correspond to that (separate program) are just in 1.txt 2.txt and so on. Is there a way to iterate through the files in a given directory renaming them to the names in the text file using just the core utils ie mv, ls, grep, awk, sed. The system is a standalone RHEL box that is kind of old and no way to get patches or connect to repos with new programs.
i=1; for file in $(program); do mv $i.txt $file; i=$((i+1)); done
.