I have 3 files in my current working directory as follows:
abc def xyz.tgz
ghi jkl xyz.tgz
def klm zxc.tgz
I wish to rename the files such that the spaces should be replaced with an underscore. To achieve this I used the following approach:
rename -v 's/\ /_/g' *tgz
Following are the issues:
- The command executes without any error, but no files are renamed.
When the directory contains only one tgz file, an error is observed as follows:
rename: not enough arguments
If I use the following:
rename " " "_" *.tgz
Only one occurrence of space is replaced with an underscore.