Reputation: 1
hi am a total noob in shell scripting,
i want to make a findandfix.sh to search for a all files called file.xml inside a all directories inside FOLDER1 and replace a a specific line in all them that begin with <linex=
with <activate=option1,option2
FOLDER1
|
|---->FOLDER2
| |->file.xml
|
|---->FOLDER3
| |->file.xml
|
|---->FOLDER4
| |->file.xml
|
|---->FOLDER5
|->file.xml
i think it will require using find
and sed
but i don't know how to put them together to do the job.
Upvotes: 0
Views: 38
Reputation: 185831
If I understand you well :
find /system/home/user/folder1 -name 'file.xml' -exec sed -i 's@linex=@activate=option1,option2@' {} \;
Make a backup before test, or remove the -i
switch
Upvotes: 2