简体   繁体   English

删除多个 csv 文件的行

[英]Delete rows for multiple csv files

I am trying to merge multiple csv files while deleting the 2 first rows of each file.我正在尝试合并多个 csv 文件,同时删除每个文件的前 2 行。 I came up with something like this:我想出了这样的事情:

@echo off
(for %%f in (*.csv) do more +2 "%%f") >> output.csv
echo Done.

There are 12 files of 26Mo (253 612 rows in each file). 26Mo有12个文件(每个文件253 612行)。 But the process stops at row 65 534, making a 6Mo file.但该过程在第 65 534 行停止,生成一个 6Mo 文件。

I think this is the fastest way to do that in a Batch file:我认为这是在批处理文件中执行此操作的最快方法:

@echo off

(for %%f in (*.csv) do (
   < "%%f" ( 
      set /P "=" & set /P "="
      findstr "^"
   )
)) > output.tmp

ren output.tmp output.csv

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM