Issue
I was wondering if you guy could help. I am using a Debian 9
I need to rename all jpegs in a folder, all my jpegs are like this image_E01760728_20220301122915852_TIMING.jpg
to this 20220301122915.jpg
(removing image_E10176072_
& _TIMING
& removing last three characters . The string 20220301122915852
is a date, month, hour, min, seconds etc capture time.
So basically my timelapse system would see pictures like this; 20220301122915.jpg
Thank you in advance
Solution
Use:
for f in *jpg; do mv "$f" "$(echo "$f" |awk -F[=_] '{print $3}' |sed 's/.\{3\}$//')".jpg ; done
Answered By - GAD3R Answer Checked By - Timothy Miller (WPSolving Admin)