DosTips.com

A Forum all about DOS Batch
It is currently 02 Dec 2016 18:20

All times are UTC-06:00




Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 02 Mar 2012 10:34 
Offline

Joined: 05 Sep 2011 09:15
Posts: 114
Code: Select all
For /F "tokens=*" %%B IN (test.txt) DO (
   SETLOCAL ENABLEDELAYEDEXPANSION
   SET t=is
   SET old=%%B
   SET new=!old:t=!
   ECHO !new!
   
   ENDLOCAL
)


Two questions.
First, can I store the target text ("is") in the variable t and put t within the !!variable? It seems not working.
Second, how can I substitute "=" the equal sign with something else?

I can't do this. There are two equal signs.
Code: Select all
SET new=!old:==!


Top
   
PostPosted: 02 Mar 2012 15:28 
Offline
Expert

Joined: 10 Feb 2012 02:20
Posts: 6033
You can use SED or a search and replace script to replace "is" and "=" with other things.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 2 posts ] 

All times are UTC-06:00


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited