input:
T501-08680-0102 0501-08690-0100
T501-08680-0102 T501-08699-0100
I would like to have output like this: the second line T501-08680_0102 is duplicate one should be removed
output:
T501-08680-0102 0501-08690-0100 T501-08699-0100
I tried this code but looks like hard-coded when the string is changing there is an issue
Code: Select all
@echo off
setlocal enabledelayedexpansion
set "string=T501-08680-0102 0501-08690-0100 T501-08680-0102 T501-08699-0100"
set "newstring="
for %%i in (%string%) do (
echo !newstring!|findstr /i "\<%%i\>" >nul || set "newstring=!newstring! %%i"
)
echo %newstring:~1%
there must be some way not like the above code when I do not know which string is coming
Thanks