I want to read a csv file and store a value in a variable and use that variable value to be written as a last column of the same file.
@echo off
del three.txt
setlocal ENABLEDELAYEDEXPANSION
set N=1
for /f "tokens=* delims= " %%a in (combined.csv) do (
set /a N+=1
if !N! equ 7 >> three.txt echo.%%a
)
for /f "tokens=1-10 delims=, " %%a in (three.txt) do (
SET x=%%g
)
echo %x% >> three.txt
endlocal
I want the last read value which is in three.txt to be stored in a variable and use the same to be print a column in the same file. Below is the data in combined.csv
,Safaricom,,,,Channel to subscriber transfer,,,,,,,,,
,,,,,,,,,,,Report code :,,C2STRANSFER02,
,Network name :,,Safaricom,,,,,,,Service:,,,ALL,
,Zone :,,Safaricom Zone,,,,,,,Category :,,,ALL,
,Domain :,,Dealer Domain,,,,,,,User name :,,,ALL,
,Dated :,,02/12/15 08:56:46,,,,,,,Date :,,,01/12/15,
,Sl. No.,Transaction ID,,Request source,User name,Sender mobile number,Receiver mobile number,Service
class,Service,Sub-service,Requested amount,Credit amount,Bonus,Process fee
,Transfer,,,,,,,,,,,,,
,1,R151201.2053.140019,,EXTGW,GAZETI LIMITED,700945609,700648591,PREPAID,Customer Recharge,Airtime,130.00,130.00,0.00,0.00
,2,R151201.2243.140015,,EXTGW,GAZETI LIMITED,700945609,727783637,PREPAID,Customer Recharge,Airtime,50.00,50.00,0.00,0.00
I had read the date 01/12/15 from the combined.csv I want to store it in a variable and store the same date for all the records as a last column.