I have an 8 bit address of a variable and then want to turn it into a decimal variable address
example "source.txt"
Code: Select all
0.0,Some-Variable
0.1,Some-Variable
0.2,Some-Variable
0.3,Some-Variable
0.4,Some-Variable
0.5,Some-Variable
0.6,Some-Variable
0.7,Some-Variable
1.0,Some-Variable
1.2,Some-Variable
1.5,Some-Variable
1.6,Some-Variable
1.7,Some-Variable
my batch program
Code: Select all
@echo off
set inFile="source.txt"
set outFile="result.csv"
set cnt=0
(
for /f "usebackq tokens=1-3 delims=.," %%A in (%inFile%) do (
set /a "cnt=(%%A*8)+(%%B+201)"
call echo %%cnt%%,%%C,#
)
)>%outFile%
the results of my program "result.csv"
Code: Select all
201,Some-Variable,#
202,Some-Variable,#
203,Some-Variable,#
204,Some-Variable,#
205,Some-Variable,#
206,Some-Variable,#
207,Some-Variable,#
208,Some-Variable,#
209,Some-Variable,#
211,Some-Variable,#
214,Some-Variable,#
215,Some-Variable,#
216,Some-Variable,#
what should I add to my batch program so that the expected outcomes are as follows:
Code: Select all
201,Some-Variable,#
202,Some-Variable,#
203,Some-Variable,#
204,Some-Variable,#
205,Some-Variable,#
206,Some-Variable,#
207,Some-Variable,#
208,Some-Variable,#
209,Some-Variable,#
210,Null,#
211,Some-Variable,#
212,Null,#
213,Null,#
214,Some-Variable,#
215,Some-Variable,#
216,Some-Variable,#
thanks for the time you spend.