Page 1 of 1

Batch Script : Space issue with text file to remove

Posted: 22 Aug 2019 04:27
by Rajnishjc_27
Hi Friends,

I have a data like below in .TXT file

id name Add
1 ; Severe weather - snow In
2 ; ;

now in my 2 id name is blank, now how to check blank field or avoid or length of the of the field in below batch script.

setlocal enabledelayedexpansion
for /F " skip=1 tokens=2 delims=;" %%b in (%file% ) do (
echo %%b
)

Re: Batch Script : Space issue with text file to remove

Posted: 24 Aug 2019 07:56
by pieh-ejdsch
hallo,
use a real token (1st)

Code: Select all

for /F " skip=1 tokens=1,2 delims=;" %%a in (%file% ) do if "%%b" NEQ "" (
  echo %%b
) else echo EMPTY
Phil