copy a column in a .csv file to another using batch

前端 未结 1 1730
逝去的感伤
逝去的感伤 2021-01-27 21:53

I have a file that has

Class,section,name
Math,02,Scott

What I need is a .csv that copies a column so it looks like below

Class         


        
1条回答
  •  鱼传尺愫
    2021-01-27 22:21

    @ECHO OFF
    SETLOCAL
    (
    FOR /f "tokens=1-3delims=," %%a IN (q22334682.txt) DO (
     ECHO(%%a,%%b,%%c,%%a
    )
    )>new.csv
    
    GOTO :EOF
    

    -Assuming that the case of the class header on the generated column in the file should match that in column 1.

    I used a file named q22334682.txt for my testing, putting the result in new.csv.

    0 讨论(0)
提交回复
热议问题