Delete certain text from xml file with a batch file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
heula
Posts: 3
Joined: 24 Dec 2015 13:17

Delete certain text from xml file with a batch file

#1 Post by heula » 24 Dec 2015 13:39

I have a guide.xml file and that file contains multiple words / line I want to remove from the file.

Is there a batch file that can do that for me?
I want to run that batch as a scheduled task every day.

In this https://dl.dropboxusercontent.com/u/901529/Media%20Browser/Overige%20fora/guide.xml file are thes two words / line that I like to be removed from it.

1. (?)
2. dit is temp_8

Hope someone can help me out here.

Thanks and merry christmas

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Delete certain text from xml file with a batch file

#2 Post by foxidrive » 24 Dec 2015 18:05

Do you want to remove the entire lines that contain those terms?

heula
Posts: 3
Joined: 24 Dec 2015 13:17

Re: Delete certain text from xml file with a batch file

#3 Post by heula » 25 Dec 2015 01:41

Just those terms. not the whole line.

Line like it is now

<title lang="nl">The big bang theory (?)</title>
<desc lang="nl">dit is temp_8 (Spike/tvgids.nl)</desc>

Like I would see it.

<title lang="nl">The big bang theory</title>
<desc lang="nl"> (Spike/tvgids.nl)</desc>

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Delete certain text from xml file with a batch file

#4 Post by foxidrive » 25 Dec 2015 02:19

Code: Select all

@echo off
call jrepl "(?)"           "" /L /I /F "guide.xml" /o -
call jrepl "dit is temp_8" "" /L /I /F "guide.xml" /o -



This above uses a native Windows batch script called Jrepl.bat (by dbenham)
jrepl.bat can be downloaded from: https://www.dropbox.com/s/4otci4d4s8x5ni4/Jrepl.bat
and it can also be found here: viewtopic.php?f=3&t=6044

Place it in the same folder as the batch file, or in a folder that is on the system path.

heula
Posts: 3
Joined: 24 Dec 2015 13:17

Re: Delete certain text from xml file with a batch file

#5 Post by heula » 25 Dec 2015 04:13

foxidrive wrote:

Code: Select all

@echo off
call jrepl "(?)"           "" /L /I /F "guide.xml" /o -
call jrepl "dit is temp_8" "" /L /I /F "guide.xml" /o -



This above uses a native Windows batch script called Jrepl.bat (by dbenham)
jrepl.bat can be downloaded from: https://www.dropbox.com/s/4otci4d4s8x5ni4/Jrepl.bat
and it can also be found here: viewtopic.php?f=3&t=6044

Place it in the same folder as the batch file, or in a folder that is on the system path.

Thanks, this works.

Post Reply