I have a folder full of jpegs formatted like this:
0001_20210516_XYZ.jpg
0002_20210516_XYZ.jpg
123_20210516_XYZ.jpg
01_20210516_XYZ.jpg
and I want to rename all files so the date string in the middle is removed so the files look like:
0001_XYZ.jpg
0002_XYZ.jpg
123_XYZ.jpg
01_XYZ.jpg
I tried using this answer to write the regex to remove 8 digits using this code:
rename - 's/^_\d{8}\_//' *
But this did not do anything. I am not sure how to format this correctly so the middle date string is removed.