DosTips.com

A Forum all about DOS Batch
It is currently 24 Jul 2016 22:19

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:
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:
SET new=!old:==!


Top
   
PostPosted: 02 Mar 2012 15:28 
Offline
Expert

Joined: 10 Feb 2012 02:20
Posts: 5789
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: Bing [Bot] and 2 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

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