home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch.nt      Fun with Windows NT batch files      68,980 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 67,295 of 68,980   
   npocmaka to sandeep...@gmail.com   
   Re: String replacement not working   
   17 Sep 18 08:01:39   
   
   From: npocmaka@gmail.com   
      
   On Monday, September 17, 2018 at 9:26:49 AM UTC+3, sandeep...@gmail.com wrote:   
   > I am trying to do a string replacement in a batch file and it is not   
   working. What am I doing wrong? All I want to accomplish is to remove the   
   thousand comma separators in the number   
   >   
   > ===============Script===============   
   > @echo off   
   >   
   > for /f "tokens=1,2,4,5,7,8 delims=;" %%A in (Test.csv) do (   
   >   
   > set myAmt=%%D:,=%   
   > echo D : %%D   
   > echo Amount : %myAmt%   
   > )   
   > ===============Script===============   
   >   
   > ================Test.csv file========   
   > A;B;C;D;-1,00,194.00;F;F;G   
   > A;B;C;D;-1,000.00;F;F;G   
   > ================Test.csv file========   
   >   
   > ===============Output===============   
   > D : -1,00,194.00   
   > Amount : 1,00,194.00:,=   
   > D : -1,000.00   
   > Amount : 1,00,194.00:,=   
   > ===============Output===============   
      
   You need delayed expansion - https://ss64.com/nt/delayedexpansion.html   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca