I have hundreds of files in a directory with the same suffix and unique alphanumeric prefixes like this:
ABC01234.sorted_dup.bam
ABC04271.sorted_dup.bam
ABC09287.sorted_dup.bam
I have a file with new unique alphanumeric prefixes in one column spefic to each of the original prefixes like this:
GBH03987 ABC01234
GBH05430 ABC04271
GBH07651 ABC09287
I would like to replace the original prefixes with the correct prefixes from the file i.e. replace the prefixes in the filenames in the directory with the prefixes in column 1. The resulting filenames will have prefixes that are based on column 1 like this:
GBH03987.sorted_dup.bam
GBH05430.sorted_dup.bam
GBH07651.sorted_dup.bam
What is the easiest solution for someone new to unix? Preferably an awk or sed solution would be greatly appreciated.