For example I have a file named 5.jpg.  How can I rename it to aaaaa.jpg with char a 5 times.I tried rename -v 's/(\d{1,})/a{$1}/g' * but this renames 5.jpg to a{5}.jpg, which is not what I want. I understand that second part of function isn't a regexp, this was just an attempt.
How to add some characters to filename via 'rename'?
linux;files;rename
At least three different utilities imaginatively named rename(1) are floating around in the Linux waters: (1) the one that came with util-linux, (2) an older Perl script by Larry Wall further munged by Tom Christiansen, and (3) a newer Perl script evolved from the former and included with Unicode::Tussle.  As far as I can tell, what you want can't be done with the util-linux version of rename(1).  It can be done with either of the Perl scripts though:rename -n 's/(\d+)/a x $1/e' 5.jpgOutput:rename 5.jpg aaaaa.jpg(drop the -n to actually rename the file).