I have some files in a directory that that all contain either the string "HG-U133A", or "HG-U133B". I'd like to write a script that can go through all the files in the directory and rename all the "HG-U133A" files with an "A_" prefix, and all "HG-U133B" files with a "B_" prefix.
So if these are the files in my directory
> grep "HG-U133[AB]" *
fileA.txt: HG-U133A
fileB.txt: HG-U133A
fileC.txt: HG-U133B
fileD.txt: HG-U133A
fileE.txt: HG-U133B
I'd like to write a script that can rename these files to
> ls
A_fileA.txt
A_fileB.txt
B_fileC.txt
A_fileD.txt
B_fileE.txt
I'd really appreciate some help with this. Thank You