Computing.Net > Forums > Programming > Find/Replace Script- HELP!

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Find/Replace Script- HELP!

Reply to Message Icon

Name: Zephyrus14
Date: March 23, 2009 at 12:48:47 Pacific
OS: Windows XP
Subcategory: Batch
Comment:

Hello,

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!



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: March 23, 2009 at 13:42:19 Pacific
Reply:

@echo off & setlocal EnableDelayedExpansion > C:\Folder\output.new
for /F "delims=" %%j in (C:\Folder\output.txt) do (
  set row=%%j
  set row=!row:MGR_SP=VBS_6UP!
  echo.!row!>> C:\Folder\output.new
)
del C:\Folder\output.txt
ren C:\Folder\output.new output.txt
:: End_Of_Batch


0

Response Number 2
Name: ghostdog
Date: March 23, 2009 at 20:09:09 Pacific
Reply:

get sed for windows and on command prompt

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


0

Response Number 3
Name: Zephyrus14
Date: March 27, 2009 at 15:15:34 Pacific
Reply:

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!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Find/Replace Script- HELP!

Find replace dialog acting unusual www.computing.net/answers/programming/find-replace-dialog-acting-unusual/7753.html

Script Help www.computing.net/answers/programming/script-help/19814.html

Script help - New line and character removal? www.computing.net/answers/programming/script-help-new-line-and-character-removal/19883.html