OT: App for relplacing text

Okay, i have been spending hours each day building metadata for my shows, each day i get a little better and TONY’s app has been an incredible help.

But i have around 25 TV shows, some have up to 9 seasons.

That being said, if i want to make a change within a metadata file, i have to do it to 22 metadata’s per season, and up to 9 seasons… this can be daunting…

I just use notepad to edit my XML’s and used the ‘replace’ option for changing plot to overview

Tony’s app fixed this, but i would like to go back and add a few backdrops to each metadata

So to get to the point, is there any application that allows me to replace text within a file, but to choose 25 files and have it automatically replace all the text within all 25 files, instead of having to individually open each xml and replace the text one by one. Some kind of app that lets me choose all the text files in a folder and click replace and have it replace the text not just within one, but all 25 ?

Hi there…

Such an app would actually not help… Each XML file exists to control a specific setting, hence, they need to be different…


I do this in Linux all the time using a command line called “SED” which stands for “Stream Editor.”

It can be a tad daunting to learn if you’re not familiar with “Regular Expressions.”   But to give you an example of how one could use SED to do this, the command line to add an additional backdrop in a whole lot of files in one folder would be:

sed -i 's/<\/details>/\t<backdrop>http:\/\/AdditionalBackropsURL<\/backdrop>\n<\/details>' *.xml

(That’s should appear all on one line, by the way.)

Breaking that command down:

sed -i means edit “In Place,” or in the file itself.

The basic format used here is s/something/else/

Which replaces SOMETHING with ELSE.

So the first part is the SOMETHING:  </details>

Which we’re looking for the closing tag of </details>. The SLASH (/) is ESCAPED, because we actually need to keep that tag as is. So you see a () in front of it so that the interpreter doesn’t think that the first slash is actually the end of the SOMETHING part.

Then we have a regular (NON-ESCAPED) SLASH, which means that we’re at the next part which is what we want to put in to REPLACE the SOMETHING:


The \t means a TAB character, to keep the XML pretty.

Then we have the <backdrop>http://AdditionalBackropsURL</backdrop> part, noting again that all the important SLASHES are ESCAPED with .

Finally it ends with a \n (which is a NEW LINE) and </details> which is putting the </details> tag back at the end (with the SLASH ESCAPED!)

Then we end with a CLOSING SLASH which is NOT Escaped, and an apostraphe to close the whole string, and the characters '*.xml" which means we want to do this to EVERY XML FILE in the current folder.

Takes about a second to modify a hundred files.

You can download SED for Windows from any number of places, like this:http://gnuwin32.sourceforge.net/packages/sed.htm

1 Like