简体   繁体   English

批处理文件->复制和比较ASCII文件

[英]Batch file -> copying and comparing ASCII files

Can anyone help me write this batch file? 谁能帮我写这个批处理文件?

  1. If there is no csv file inside "copy\\" folder, batch file to copy "original\\file.csv" to "copy\\file.txt" 如果“ copy \\”文件夹中没有csv文件,则将批处理文件复制到“ original \\ file.csv”到“ copy \\ file.txt”
  2. Batch file to generate another csv file with the differences between the newest .OK and the "copy/file.txt". 批处理文件以生成具有最新.OK和“ copy / file.txt”之间差异的另一个csv文件。

First point: 第一点:

if not exist "copy\\file.csv" copy "original\\file.csv" "copy\\file.csv"

Second point: 第二点:

@echo off
( for /f "delims=" %%i in (file.txt) do (
    findstr /C:"%%i" file.OK  >nul || echo %%i
  )
)>out.txt

Pseudo-Code for better understanding: 伪代码可以更好地理解:

For each line in file text do:
  Does this line exist in file.OK? If not, write the line...
...to out.txt

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

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