I have a directory containing thousands of files with names
t_00xx_000xxx.png
and 00xx_000xxx.png
. I want to change the names of the files which starts with t_
, like t_00xx_000xxx.png
to 00xx_000xxx_t.png
So take the prefix and put it as a postfix for some of the files. Can this be done in only one command?
I am running on SUSE SLES12 SP2.
Best Answer
This will work if we assume everything up to the first underscore to be the prefix.
Remove the
#
in front ofmv
if you're happy with the output.With
prename
it would be a little easier:If
t_
is always the prefix, change to this pattern: