Find/Replace Script- HELP!

March 23, 2009 at 12:48:47
Specs: Windows XP

I am trying to make a batch program that opens up a txt file (output.txt) in C:\Directory
I need it to search for "MGR_SP" and replace it with "VBS_6UP".

Someone please help!

See More: Find/Replace Script- HELP!

Report •

March 23, 2009 at 13:42:19
@echo off & setlocal EnableDelayedExpansion > C:\Folder\
for /F "delims=" %%j in (C:\Folder\output.txt) do (
  set row=%%j
  set row=!row:MGR_SP=VBS_6UP!
  echo.!row!>> C:\Folder\
del C:\Folder\output.txt
ren C:\Folder\ output.txt
:: End_Of_Batch

Report •

March 23, 2009 at 20:09:09
get sed for windows and on command prompt

# sed -i "s/MGR_SP/VBS_6UP/" file

Report •

March 27, 2009 at 15:15:34
Thank you IVO,

That worked great!

I have looked into using SED, but I have decided that it would be not practical for my needs. Thanks anyways ghostdog!

Report •

Related Solutions

Ask Question