Advertisement

12.20.2005 at 07:47AM PST, ID: 21670668
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.2

Replace text string using batch file

Asked by qvhit in MS DOS

Tags: , , , ,

Previously I recieved help from SteveGTR to create the batch file below which changes the UserName variable into a different format then calls on a standard PRF file and creates a new one with the correct UserName format.  The problem was that the batch file replaced the Value for MailboxName in each section and not just in section 4 where it was needed.  So the only way I can think to correct this issue is to make the MailboxName in section 4 unique and for the batch file to look for that instead.

So I changed the PRF (in section 4) and the batch file from MailboxName to MailboxNameChange and it has the desired effect.  Problem is that I now need the same batch file to look for anything in the output file by the name of MailboxNameChange and convert it back to MailboxName so that I can run the PRF correctly.

Thanks


@echo off

setlocal enabledelayedexpansion

set un=%~1

if "%un%"=="" set un=%username%

set /a pos=1

:NEXTCHAR

if "!un:~%pos%,1!"=="" echo Parsing error&goto :EOF

for %%a in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
  if "!un:~%pos%,1!"=="%%a" (
    set /a pos+=1
    goto NEXTCHAR
  )  
)

set /a pos-=1

set MailboxNameChange=!un:~%pos%! %un:~0,1%

REM ** Change this part
set inFile="c:\prf\v1.prf"
set outFile="C:\prf\V1a.prf"
set workFile="temp.txt"


>%workFile% find /N /V "_STM_STM_" %inFile%

if exist %outFile% del %outFile% >NUL

set /a lineCnt=0

for /f "skip=2 tokens=1,2 delims==" %%a in ('type %workFile% 2^>NUL') do call :PROCESS "%%a" "%%b"

if exist %workFile% del %workFIle% >NUL

echo Output in %outFile%

goto :EOF

:STRIPLINENUMBER

set str=%~1

:SLN_NEXTCHAR

if "%str:~0,1%"=="]" goto GOTLINE

set str=%str:~1%
goto SLN_NEXTCHAR

:GOTLINE

set str=%str:~1%

goto :EOF

:PROCESS

set /a lineCnt+=1

echo Processing line %lineCnt%

if "%~2"=="" goto NOVALUE

set valuePart=%~2

for /f "tokens=2 delims=] " %%a in ('echo %~1 2^>NUL') do if "%%a"=="MailboxNameChange" set valuePart=%mailboxnamechange%

CALL :STRIPLINENUMBER "%~1"

>>%outFile% echo %str%=%valuePart%

goto :EOF

:NOVALUE

call :STRIPLINENUMBER "%~1"

if "%str%"=="" (
  echo.>>%outFile%
  goto :EOF
)

>>%outFile% echo %str%Start Free Trial
[+][-]12.20.2005 at 07:51AM PST, ID: 15519176

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.20.2005 at 08:09AM PST, ID: 15519336

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.20.2005 at 08:22AM PST, ID: 15519465

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.20.2005 at 08:41AM PST, ID: 15519654

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.20.2005 at 10:56AM PST, ID: 15520876

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.20.2005 at 10:57AM PST, ID: 15520881

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.22.2005 at 03:38AM PST, ID: 15533225

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.22.2005 at 05:45AM PST, ID: 15533760

View this solution now by starting your 14-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MS DOS
Tags: replace, string, batch, file, text
Sign Up Now!
Solution Provided By: SteveGTR
Participating Experts: 1
Solution Grade: A
 
 
[+][-]12.28.2005 at 12:58AM PST, ID: 15561312

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-43