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.
Batch Script Remove Space from Text Field.
Moderator: DosItHelp
Re: Batch Script Remove Space from Text Field.
Hi!
You should really check out the "help set" command.
With this you can replace every space to another character/string, or even remove them with
I hope that helps
You should really check out the "help set" command.
(This is from an online documentation https://www.robvanderwoude.com/ntset.php; I cant copy straigth from console because of the localisation.)Environment variable substitution has been enhanced as follows:
%PATH:str1=str2%
would expand the PATH environment variable, substituting each occurrence of "str1" in the expanded result with "str2". "str2" can be the empty string to effectively delete all occurrences of "str1" from the expanded output. "str1" can begin with an asterisk, in which case it will match everything from the beginning of the expanded output to the first occurrence of the remaining portion of str1.
With this you can replace every space to another character/string, or even remove them with
Code: Select all
!string1: =!
Re: Batch Script Remove Space from Text Field.
I found a better website with examples:https://ss64.com/nt/syntax-replace.html