I have about 5,000 files with an error I need to correct. Each file has a section that looks something like:
<rating system="nl-movies">16.0</rating>
<rating system="ro-movies">8.0</rating>
<rating *something*>A.0</rating>
I need to remove the .0 from each of these, so that the text instead looks like:
<rating system="nl-movies">16</rating>
<rating system="ro-movies">8</rating>
<rating *something*>A</rating>
In other words, I need to replace .0</rating> with </rating>. How would I do this in unix and make the changes recursive down the folder structure?
Thanks for all the help: this is what ended up working:
find ./ -type f -name '*.xml' -exec sed -i 's/\.0<\/rating>/<\/rating>/g' {} \;
Something like the following should do this for you
Replace
/some/pathwith the path of the base directory you would like to start the replacements, you might also want to add something like-name *.xmlto thefindcommand if all files have the same suffix.