'A shell script to to replace a value in all the existing files with the same name having different folder names

My folder structure:-

Container(Main folder)
subcontainer1(inside this we have a file package.json)
subcontainer2 (inside this we have a file package.json)
subcontainer3 (inside this we have a file package.json)

This below command is working for a particular folder as I have given the exact path

My requirement is to update all the files which are under these folders as there can be any so that should be dynamic

Working Command is:-

sed -i -e 's/publicConfigRepoUrl/publicConfigUrl2/g' Container/subcontainer1/package.json

what I have tried and that is not working:-

sed -i -e 's/publicConfigRepoUrl/publicConfigUrl2/g' Container\/[A-Za-z]*[0-9]*\/package.json

In this I have tried to cover all the folder which are inside the container folder but it is not working.



Solution 1:[1]

The solution which worked for me is:- sed -i -e “s/publicConfigRepoUrl/publicConfigUrl2/g” Container/*/package.json

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Manik Kumar