I am new to scripting and have a requirement where I need to change the special characters from file and replace with some other character.
Below is the file name where I have to replace the ? by _.
file - 21041159?74DECL?ARAÇÃO14581?5904289?6770700.pdf
result - 21041159_74DECL_ARAÇÃO14581_5904289_6770700.pdf
find . -depth -name '*\?*' -type f -execdir bash -c 'mv "$1" "${1/\?/_}"' -- {} \;
The above script changes the first occurrence of question mark to underscore but not from complete file name.
Please suggest what can be done?
renamecommand and its regex feature.