Remove duplicates in a Csv batch file

1

I have the following code, it works fine but if it contains in some line the following character ! ends up deleting all the information or leaving it wrong

Example of input of the Csv file.

Column 1    Column2    Column3
Hello        0001       abc  
hello        0002       fge
heLLo        0001       abc
hello!       0003       geg

What I should do.

Column 1    Column2    Column3
Hello        0001       abc  
hello        0002       fge
hello!       0003       geg

What my code does.

Column 1   
hello03

The Code

    @echo off
setlocal EnableDelayedExpansion
set src=Clean\File.csv
set line=
(for /F "delims=" %%L in ('sort %src%') do (
   if not ~!line!~ == ~%%L~ echo %%L
   set line=%%L
)) > "%Final.csv
    
asked by user8590779 05.12.2018 в 21:55
source

0 answers