Grouping similar files in folders
<p>I would like to group similar files in folders in a same directory. TO give a better idea, i am working on image datasets where I have images of several subjects with varying filenames. however I will have 10-15 images per subject in the dataset too. So lets say subject A will have 10 images named as A_1.png, A_2.png, A_3.png and so on. So, similarly we have n number of subjects. I have to group the subjects in folders having all the images corresponding to that subject. I tried using python but it I was not able to get to the point right. Can we do it using bash or shell scripts? If yes, please advise.</p>