extracting specific lines of data from multiple text files, to convert to a single csv file

后端 未结 2 1208
梦毁少年i
梦毁少年i 2020-12-20 06:32

First, apologies for my poor coding ability, however I have spent a few hours reading the forums and giving it a crack, so I would really appreciate any help with the follow

2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-20 06:51

    You could read the lines with another construct.

    setlocal EnableDelayedExpansion
    < %1 (
    Set /p line1=
    
    Set /p line2=
    Set /p line3=
    Set /p line4=
    Set /p line5=
    Set /p line6=
    Set /p line7=
    )
    Echo %1,!line3!,!line5!,!line7!
    

    Or with a loop (Andriy)

    Setlocal EnableDelayedExpansion
    <%1 (
      For /L %%n in (1 1 7) do (
        Set /p line%%n=
      )
    )
    Echo %1,!line3!,!line5!,!line7!
    

提交回复
热议问题