Batch Script Remove Space from Text Field.
Posted: 21 Aug 2019 23:05
Hi Friends,
I have a data like below in .TXT file.
Id Name Address CurrierNo
001 XYX Mum M 123
002 ZZZ Bom B 456
and i have use script as below.
for /f " skip=1 tokens=4 delims=; " %%c in (%file% ) do (
setlocal enabledelayedexpansion
SET "string1=%%c" & CALL D:\Rajnish_GTT\isnumeric.bat result1 !string1!
if "!result1!" equ "N" (
echo(field "%%~c" Is Not a Numeric)
)
according to Tokens=4 should check Currier No Fields, but instead of that its considering " Mum M" because its taking space in Token.
Please help , how can i handle the space (remove) in text fields in script.
Thank you.
I have a data like below in .TXT file.
Id Name Address CurrierNo
001 XYX Mum M 123
002 ZZZ Bom B 456
and i have use script as below.
for /f " skip=1 tokens=4 delims=; " %%c in (%file% ) do (
setlocal enabledelayedexpansion
SET "string1=%%c" & CALL D:\Rajnish_GTT\isnumeric.bat result1 !string1!
if "!result1!" equ "N" (
echo(field "%%~c" Is Not a Numeric)
)
according to Tokens=4 should check Currier No Fields, but instead of that its considering " Mum M" because its taking space in Token.
Please help , how can i handle the space (remove) in text fields in script.
Thank you.