Find and delete

Microsoft Windows xp professional w/serv...
February 24, 2010 at 09:13:46
Specs: Windows XP
I have a dos variable containing 7 email addresses separated by commas. I got another variable containing one email id of one of the email address in the above variable. I have to remove that email address from the 1st variable. Is there a script to do it without using 3rd party utilities..??

See More: Find and delete

Report •

#1
February 24, 2010 at 15:38:26
maybe like:
setlocal enabledelayedexpansion
:: %emails% like: a@xx.net,b@yy.net,c@zz.net
:: %rem% is like: b@yy.net
set emails=!emails:%rem%=!
set email=!emails:,,=,!
but you might have a , in front or trailing, depending on where it the list the removal occurs.

Report •

#2
February 24, 2010 at 20:11:04
Hmm thanks.. That did work. Now lets see if i can delete the commas if i delete the first or last address. Thanks once again for the prompt reply.. :)

Report •

#3
February 24, 2010 at 21:10:26
there's prob'ly a slick way to do it? but all i know is klunky:
(after substitution)
if "%emails:~0,1%" equ "," set emails=%emails:~1%
if "%emails:~-1%" equ "," set emails=%emails:~0,-1%

Report •

Related Solutions

#4
February 24, 2010 at 21:15:12
yippee problems solved.. ha ha.. now the script is working the way i need.. thanks guys.. thanks..

Report •

Ask Question