Q:

Increase Number in Multiple Filenames Bash

i have a number of files in a folder (on linux) called 
picture20.mp4
picture21.mp4
picture100.mp4
picture115.mp4

e.t.c
I would like to increase the number displayed in each name by 3 so that i have
picture23.mp4
picture24.mp4
picture103.mp4
picture118.mp4

I have experimented with the rename command, and tried to write a bash script using basename to extract the number but all of my tries didnt have the desired output. How can i do it?

A:

You can use:
for f in picture*.mp4; do
   n="${f/picture}"
   n="${n%.*}"; ((n+=3))
   echo mv "$f" "picture$n.mp4";
done
mv picture20.mp4 picture23.mp4
mv picture21.mp4 picture24.mp4

When you're satisfied just remove echo from above command.

