I need to rename hundreds of files in Linux to change the unique identifier of each from the command line. For sake of examples, I have a file containing:
abcd_old_name1_1234.txt ==> abcd_new_name1_1234.txt
abcd_old_name2_1234.txt ==> abcd_new_name2_1234.txt
while read -r old_name new_name; do rename "s/$old_name/$new_name/" *$old_name*.txt done < file_with_names
In this way, you read the IDs from file_with_names and rename the files replacing
$new_name leaving the rest of the filename untouched.