I need to write a bash script. A folder can have multiple folders. Let's say the parent folder is ABC which has subfolders. Now all the folders including the subfolders one has a filename with a placeholder in it example _service_log.java
I need to replace the placeholder with a variable that has a value in it say ZYX in all the folders.
the output should be like ZXYlog.java
I tried the below solution However It's not working
$Service_Name="ZXY"
cd abc
for FileName in * ; do
mv -- "$FileName" "${FileName/_servicename_/$Service_Name}"
done
Can someone please help?
Appreciate all your help! Thanks in advance!