We regularly have images that are named 1234567890_GH_ANI_EPS.eps with variables after the first underscore. I would like to write a bash script to remove the first underscore up to the file extension.
Original file name: 1234567890_GH_ANI_EPS.eps New File Name: 1234567890.eps
I was able to achieve removing the last _EPS by using the below code:
for f in "$@"
do
mv "$f" "${f%_*}.eps"
done
And have tried the below and the file disappears:
for f in "$@"
do
mv "$f" "${f%%_*}.eps"
done
any help would be appreciated. Thank you