I have to rename a large number of files so that the name of each file corresponds to a code number that is given side by side in a list (textfile).
The list contains in column A the filename of the actual files to be renamed and in column B the name (a client code, 9 digits) that has to be assigned to the file.
Listfile:
file-abcd.pdf #to be renamed [tab] 123456789 #the new filename
file-abce.pdf #to be renamed [tab] 809809231 #the new filename
a.s.o
Desired outcome:
file-abcd.pdf --> file.123456789.pdf
file-abce.pdf --> file.809809231.pdf
a.s.o
It's to say "for F in each actual file in files/ named like this on the left, re-name it to the name to the right and keep the old extension... But bash did not understand this phrase
)
The names to be given are stored in a file but the files to name are actual files, so just no idea how to tackle this and where to even start.
So far all the scripting I could do and understand in bash was loops to rename just an extension to a file, or to add an extra suffix. Beginner... sigh... But there has to be a way to do it in Linux, there usually is.
Thanks in advance for your help!