An example for replacing strings with SED in DOS files

Example


sed --expression="s/Some text with slash here... \/ ala bala/Some other text/g" %2 > %2.tmp
@IF NOT %ERRORLEVEL% == 0 GOTO ERROR
@copy %2.tmp %2 /y
@IF NOT %ERRORLEVEL% == 0 GOTO ERROR

@rem other code here...
@Goto :END

:ERROR
@echo Error :(

:END

sed.exe

sed.exe is a ported utility from Linux. For DOS / Windows it is placed into:
  • UnxUtils for DOS/Windows (and an standard binary for Linux distributions)
  • CygWin

Comments

Popular posts from this blog

Аптеки в София приготвящи лекарства по рецепти

Полигони в София

Активиране на българска фонетична клавиатура при Android телефони