Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8804317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:34:18+00:00 2026-06-14T01:34:18+00:00

I have two csv files with 5 fields where the seperator is a comma.

  • 0

I have two csv files with 5 fields where the seperator is a comma. I need to compare these files and get an output file with the information which lines are added, updated or deleted.

I have found several batch scripts that do a compare using the fc or comp function but that gives only the differences between the files. I didn’t find related topics can give the results about added, updated or deleted lines.

Can anybody help me with this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T01:34:19+00:00Added an answer on June 14, 2026 at 1:34 am

    This topic is interesting! Perhaps you, like me, find confusing and annoying the output format of FC command, although it provides the required information indeed. The Batch program below take the output of FC command and rearrange it in a way that allows to identify if a new block of information has been added between two lines of original file, or if a block of lines has been deleted from the original file, or any other case of file modification (updated). The most difficult part was to choose the format to display the information in a pleasant way, but I think my solution is pretty good!

    @echo off
    rem FCOMP.BAT: Format FC output in a pleasant way
    rem Antonio Perez Ayala
    if "%~2" neq "" goto start
    echo Format FC output identifying added, deleted or updated sections
    echo/
    echo FCOMP filename1 filename2 [/switches /for /FC /command]
    goto :EOF
    
    :start
    setlocal EnableDelayedExpansion
    set while=if not
    set do=goto endwhile
    set endwhile=goto while
    set "space= "
    set "spaces39=                                       "
    fc %3 %4 %5 %6 %7 %8 %9 %1 %2 > differences.txt
    if %errorlevel% equ 1 call :FormatFC < differences.txt
    del differences.txt
    goto :EOF
    
    :FormatFC
    set /P line=
    set /P line=
    rem Process each set of differences
    :while
    %while% defined line %do%
       rem Load old and new sections of this set
       set line=
       set /P line=
       set old=0
       :while1
       %while% "!line:~0,5!" neq "*****" %do%1
          set /A old+=1
          set oldLine[%old%]=!line!%spaces39%
          set line=
          set /P line=
       %endwhile%1
       :endwhile1
       set line=
       set /P line=
       set new=0
       :while2
       %while% "!line:~0,5!" neq "*****" %do%2
          set /A new+=1
          set newLine[%new%]=!line!%space%
          set line=
          set /P line=
       %endwhile%2
       :endwhile2
       rem Identify the type of this set
       if %old% equ 2 (
          echo ======  NEW SECTION ADDED  ====================================================
          echo/
          echo(!oldLine[1]:~0,79!
          set /A new-=1
          for /L %%i in (2,1,!new!) do echo(        ^|!newLine[%%i]:~0,70!
          echo(!oldLine[2]:~0,79!
       ) else if %new% equ 2 (
          echo OLD SECTION DELETED  ==========================================================
          echo/
          echo(---------!newLine[1]:~0,70!
          set /A old-=1
          for /L %%i in (2,1,!old!) do echo -!oldLine[%%i]:~0,78!
          echo(---------!newLine[2]:~0,70!
       ) else ( rem both %old% and %new% gtr 2
          echo ==============================  SECTION UPDATED  ==============================
          echo/
          if %old% lss %new% (
             for /L %%i in (1,1,%old%) do echo(!oldLine[%%i]:~0,39!^|!newLine[%%i]:~0,39!
             set /A old+=1
             for /L %%i in (!old!,1,%new%) do echo(%spaces39%^|!newLine[%%i]:~0,39!
          ) else (
             for /L %%i in (1,1,%new%) do echo(!oldLine[%%i]:~0,39!^|!newLine[%%i]:~0,39!
             set /A new+=1
             for /L %%i in (!new!,1,%old%) do echo(!oldLine[%%i]:~0,39!
          )
       )
       rem Pass to next set of differences
       echo/
       set /P line=
       set line=
       set /P line=
    %endwhile%
    :endwhile
    exit /B
    

    Antonio

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two csv files which store an id and some associated fields that
I have two CSV files which use @ to divide each column. The first
I have two csv file ( ) I can get it to print out
I have two columns in a csv file, one of which has the time
I have two csv file. First File has date offerid clicks orders Second File
I have two files client.php and server.php. The client file send a HTTP request
I have exported a CSV file from a database. Certain fields are longer text
I have many csv files that I need to clean ( replace ponctuation by
I have two CSV files with a common column and I want to Join
Say that I have two CSV files (file1 and file2) with contents as shown

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.