no forks:
ls | perl -lne '$suf=substr($_,6); rename $_, "XXXXX-$suf"'
When you use a shell loop, the mv forks once per file. Perl's rename command does not.
(Perl's rename command has some restrictions, but in this specific case those restrictions don't apply.)
As for the rename command shown earlier, yes that works, but then you have all that confusion between two different kinds of rename and so on. If you have the right one, great, but if not, this works too.
If you don't have the perl-rename command and can't install it, you can just do this:
ls | perl -lne '$old=$_; s/(\w+)/XXXXX/; rename $old, $_'
As you can see, this uses the same substitution shown in the top answer. Of course the perl-rename has other bells and whistles (the top answer mentioned, -n already, then there's -0, -f, and so on), and the more of them you need, the more you should install that instead of rolling your own in this manner.
rename. I assume this is Larry Wall'srename, from therenamepackage in Debian and derivative (and IIRCprenameon systems of the RedHat persuasion). A very useful tool. – xenoid May 14 '19 at 07:01perl-renamein arch linux – Lesmana May 14 '19 at 10:44verboseflag, it outputs nothing and doesn't perform the file name changes, even though the current path has files with names similar to12345_foo.csv. Do I have to perform any additional task to get it working (currently on Fedora 30)? It is a cleaner approach than looping. Thanks in advance! – dandev486 May 14 '19 at 11:23renameorprename? See my comment above.man {the command}lists the authors at the end. – xenoid May 14 '19 at 11:39renameapplication, right now I'm on an Ubuntu machine, but I'll check the author and git a try toprenamewhen I get access to a Fedora machine! I've made a quick research now based on your comment and apparently the packagedrenameon RedHat based systems does not support match patterns, while theprenamedoes. Thanks for the clarification! – dandev486 May 14 '19 at 12:29rename(which is a link to /usr/bin/file-rename, itself installed with therenamepackage). – xenoid May 14 '19 at 13:39renamecommand; see https://unix.stackexchange.com/a/238862/135943 – Wildcard May 15 '19 at 06:02