I have data in csv format that gets output from SQL Server
. The data has some NULL
and N.A.
values written out which makes a column ch
@echo off
setlocal enableextensions enabledelayedexpansion
(for /f "tokens=*" %%f in (a.csv) do if not "%%f"=="" (
set "line=%%f"
set "line=!line:NULL=-1!"
set "line=!line:N.A.=-2!"
echo(!line!
)) > b.csv
endlocal
This will work if, as stated by OP, the file is in the format indicated, containing only integers, NULL and N.A., or at least it does not include special characters.