?
Solved

Batch to scan test file and change content

Posted on 2012-04-13
4
Medium Priority
?
364 Views
Last Modified: 2012-04-17
I need a batch file to scan the attached file for the E01, E11 and E18 characters and replace them all with S11.  Open the attached and you will see what I mean. I then either need the batch to resave the file as the original filename, or have it save a new file with the output.  I need everything in the file carried over to the new file with the changes made above.
120415.txt
0
Comment
Question by:murryc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
paultomasi earned 2000 total points
ID: 37844965
Please give this a whirl.

Run the batch file passing the file as a parameter like this:

    BATCH 120415.txt

Where 'BATCH' is the name of your batch file and '120415.txt' is the name of your text file.
@echo off
setlocal enabledelayedexpansion

(for /f "tokens=* usebackq" %%a in ("%~1") do (
  set Line=%%a
  set Line=!Line:,E01,=,S11,!
  set Line=!Line:,E11,=,S11,!
  set Line=!Line:,E18,=,S11,!
  echo !Line!
))>"%~1.tmp"

move /y "%~1.tmp" "%~1"

Open in new window

0
 

Author Comment

by:murryc
ID: 37853636
I love it!  It works like a charm.
0
 
LVL 11

Expert Comment

by:paultomasi
ID: 37855601
Thanks for choosing my excellent batch file as your solution...
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Introduction to Processes
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question