Question : Find and Replace string to files contins spaces in file name

Hi All,
I am trying to find and replace the string recursively in all ".xml" files, but the problem is that many xml files has spaces in there names.

Suppose:

"find me not.xml", "you will.xml", or "not possible.xml" etc

so my script is able to replace string in all other xml files which does not contain spaces in there name but unable to replace which conatins spaces in there name.

here is my shell script:
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
#!/bin/bash
 
for files in `find /cygdrive/d/MechRepo/workspace -name "*.xml" -type f`
do
 
`perl -pi -e 's/7\.2\-SNAPS/9\.5\.0\.200/g' $files`
`rm -R -f d:/MechRepo/workspace/*.bak`
 
done
Open in New Window Select All

Answer : Find and Replace string to files contins spaces in file name

Your script can be a one liner.  You don't need to do the rm as you aren't creating any .bak files
1:
2:
#!/bin/bash
find /cygdrive/d/MechRepo/workspace  -name "*.xml" -print0 | xargs -0 perl -pi -e 's/7\.2\-SNAPS/9\.5\.0\.200/g'
Open in New Window Select All
Random Solutions  
 
programming4us programming4us