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,296 of 68,980   
   Herbert Kleebauer to sandeepshampur@gmail.com   
   Re: String replacement not working   
   17 Sep 18 21:57:42   
   
   From: klee@unibwm.de   
      
   On 17.09.2018 08:26, sandeepshampur@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===============   
      
   I don't think this is the output of the above code.   
      
      
   @echo off   
      
   for /f "tokens=1,2,4,5,7,8 delims=;" %%A in (Test.csv) do (   
      
   set myAmt=%%D   
   call set myAmt=%%myAmt:,=%%   
   echo D : %%D   
   call echo Amount : %%myAmt%%   
   )   
      
   --- 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