使用批处理文件从CSV文件中删除第2行 [英] Delete 2nd row from CSV file with a batch file

查看:522
本文介绍了使用批处理文件从CSV文件中删除第2行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只需要使用批处理文件从csv文件中删除第二行。它总是会成为第二行,虽然文本可能不同。

I just need to delete the second row from a csv file using a batch file. Its always going to be the second row, though the text could be different.

我一直在寻找答案,但似乎他们总是比我想做的更复杂。

I keep finding answers, but it seems like they are always more complicated then what I would like to do

推荐答案

@echo off
setlocal EnableDelayedExpansion

rem Read lines from input.csv
< input.csv (

   rem Read and copy the first line
   set /P "line="
   echo(!line!

   rem Just read the second line
   set /P "line="

   rem Copy the rest of lines
   findstr "^"

) > output.csv

这篇关于使用批处理文件从CSV文件中删除第2行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆