rename -n 's:^\[.*\](.*):$1:' *
[02Rarev]QgysLJF renamed as QgysLJF
[0rwCtGh]cGdxnWH renamed as cGdxnWH
[1B2CMhq]M91oPHh renamed as M91oPHh
[1BMD7N3]0nYVP0b renamed as 0nYVP0b
[1MjkCZu]WBPYXKG renamed as WBPYXKG
[2HoSmD7]aLWLmpf renamed as aLWLmpf
^\[.*\]
matches from beginning^
of files for brackets and everything inside pair of it which is followed by anything(.*)
. So with (.*)
we just captured a group of anything after brackets that contains only files description then in replacement section s/.../REPLACEMENT/
of rename command I replaced all files names with description part by using back-reference of captured group($1
refer to index of first captured group(.*)
).
You can also use rename with class of characters matching:
rename -n 's:^\[([0-9A-Za-z]*)\](.*):$1:' *
How to create multiple files with different names and different extensions?