Search found 3 matches
- 26 Feb 2009 22:47
- Forum: DOS Batch Forum
- Topic: Replace a substring using Set command
- Replies: 5
- Views: 10919
Replace equal sign using string substitution
Hi _m, Thanks for your reply. Your slution works if both x and 2 are unique. I should be more specific in posing the question What I am trying to do is actually to search through a large text file, to find a particular substring say nrel=0, and change it to nrel=1. In this case, 0 is not unique, but...
- 26 Feb 2009 17:43
- Forum: DOS Batch Forum
- Topic: String Substitution for a tilde
- Replies: 1
- Views: 4893
Replace tilde
Hi Toshiro,
I tried this and it seemed to work for a tilde.
Doesn't work for me when its an equal sign
set str=simple equation yahoo~com
echo.%str%
set str=%str:o~c=o.c%
echo.%str%
I tried this and it seemed to work for a tilde.
Doesn't work for me when its an equal sign
set str=simple equation yahoo~com
echo.%str%
set str=%str:o~c=o.c%
echo.%str%
- 26 Feb 2009 17:30
- Forum: DOS Batch Forum
- Topic: Replace a substring using Set command
- Replies: 5
- Views: 10919
Replace a substring using Set command
Under the section Replace a substring using string substitution, an example is given as set str=teh cat in teh hat echo.%str% set str=%str:teh=the% echo.%str% what if the substring to be replaced contains an equal sign? For instance. try replace x=2 by y=3 set str=simple equation x=2 echo.%str% set ...