windows - Script to delete one alphabet from XML file -


i delete 1 symbol "&" hundred xml file's regularly. instead of doing manual work, want write .bat script , schedule it. when bat script runs, & symbol xml files has deleted script.

we have location d:\transfer\, in location application generate xml files regularly. want search symbol (&) in 1 line of xml , delete & symbol xml.

can please me out this?

try this:

@echo off &setlocal set "search=&" set "replace="  %%a in ("d:\transfer\*.html") call:process "%%~a" goto:eof  :process set "textfile=%~1" set "newfile=%~1.new" (for /f "delims=" %%i in ('findstr /n "^" "%textfile%"') (     set "line=%%i"     setlocal enabledelayedexpansion     set "line=!line:%search%=%replace%!"     echo(!line!     endlocal ))>"%newfile%" goto:eof 

you can use sed this:

for %%a in (*.html) sed "y/&/ /" "%%~a" > "%%~na.new" 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -