How to compare text files to create a new file?

Page 1 of 3 123 LastLast

  1. Posts : 41,459
    windows 10 professional version 1607 build 14393.969 64 bit
       #1

    How to compare text files to create a new file?


    One notepad file was installed on multiple computers.
    When each computer was used the notepad file was updated.
    Text was added, removed, or modified over time to each of the files.
    The files are very different now for the same file name.

    What software is available that could compare the text and create one updated file for all of the computers?
      My Computer


  2. Posts : 31,622
    10 Home x64 (22H2) (10 Pro on 2nd pc)
       #2

    zbook said:
    What software is available that could compare the text and create one updated file for all of the computers?

    None, I suspect. Your problem is that it will require human intervention to determine which of the many changes is the definitive one.

    You can generate a list of differences between any two text files from the command prompt, piping it to a results file if you wish.

    FC A.txt B.txt
    or
    FC A.txt B.txt > Differences.txt

    For the full syntax of File Compare (FC) type FC /?
      My Computers


  3. Posts : 809
    Win10
       #3

    If you have the file that you started with then you can do multiple 3-way merges using a merge tool like kdiff3. This is a common operation for source control systems.

    But unless the changes on each computer are completely separate from each other - i.e. they don't modify the same lines of the original file - you'll have to manually merge the text no matter what.
      My Computer


  4. Posts : 11,247
    Windows / Linux : Arch Linux
       #4

    Hi folks

    @Bree

    There are linux tools to help with this so your answer of none isn't strictly speaking correct. The amount of manual intervention though depends on the number of files created / changed and the complexity of what was changed.

    @zbook

    I know this is a Windows Forum but Linux has tools to do this

    the easiest to start with is simply for each file type from command line :

    diff file1 file2

    to show differences side by side :

    diff -y file1 file2

    For a GUI use KOMP

    How to compare text files to create a new file?-snapshot3.png

    (load linux up as a Virtual machine or live distro.)

    kdiff3 is also good for 3-way merge etc.

    How to compare text files to create a new file?-snapshot4.png

    You'll still have to do some manual stuff though to adjust the files / merge into what you want.

    I know this is Windows 10 Forum but sometimes you have to use other tools !!! You wouldn't use a thimble to fill a swimming pool for example. (Maybe some of our Politicians would though !!!! - same problem world wide it seems).

    Cheers
    jimbo
      My Computer


  5. Posts : 41,459
    windows 10 professional version 1607 build 14393.969 64 bit
    Thread Starter
       #5

    Bree,
    The files are on multiple computers.
    What is the first step?
    If the file is attached in an email and then opened in another computer how should the file be saved to be compared to the other file? If this is done for a third file how should it be saved?

    These files are currently installed on this computer:
    Important commands and shortcuts
    important web pages (1)

    For practice the two files were compared:

    C:\WINDOWS\system32>fc important commands and shortcuts.txt important web pages.txt > differences.txt
    FC: Invalid Switch

    FC: cannot open IMPORTANT - No such file or folder


    jimbo45,
    What are the steps?
    Which software should be downloaded and installed?
    How do you set it up as a virtual machine?
    And how do you set it up as a live distro?

    I'm planning to make the comparison in May/June to create one new file from the multiple files.

    There may be multiple entries in one file that are similar or duplicates or triplicates. In another file there are likely new files and some of the older entries modified or deleted. The text could also be in different order.

    How does the order of the text, the duplicates and triplicates, impact the side by side comparison?
    If the first word or last word of a sentence were changed how does that impact the side by side comparison?
      My Computer


  6. Posts : 31,622
    10 Home x64 (22H2) (10 Pro on 2nd pc)
       #6

    zbook said:
    For practice the two files were compared:
    C:\WINDOWS\system32>fc important commands and shortcuts.txt important web pages.txt > differences.txt
    FC: Invalid Switch
    FC: cannot open IMPORTANT - No such file or folder
    It's the spaces in the filenames that cause problems, you need to put each one in quotes. Without them it's looking for a file just called Important.

    FC "important commands and shortcuts.txt" "important web pages.txt" > differences.txt
      My Computers


  7. Posts : 41,459
    windows 10 professional version 1607 build 14393.969 64 bit
    Thread Starter
       #7

    It displayed:

    C:\WINDOWS\system32>fc "Important commands and shortcuts.txt" "important web pages.txt" > differences.txt
    FC: cannot open IMPORTANT WEB PAGES.TXT - No such file or folder


    C:\WINDOWS\system32>fc "Important commands and shortcuts.txt" "important web pages (1)" > differences.txt
    FC: cannot open IMPORTANT WEB PAGES (1) - No such file or folder


    C:\WINDOWS\system32>fc "Important commands and shortcuts.txt "important web pages (1).txt > differences.txt
    FC: Invalid Switch

    FC: cannot open IMPORTANT COMMANDS AND SHORTCUTS.TXT IMPORTANT - No such file or folder


    C:\WINDOWS\system32>fc "Important commands and shortcuts" "important web pages (1).txt" > differeces.txt
    FC: cannot open IMPORTANT COMMANDS AND SHORTCUTS - No such file or folder


    C:\WINDOWS\system32>fc "Important commands and shortcuts" "important web pages (1).txt" > differences.txt
    FC: cannot open IMPORTANT COMMANDS AND SHORTCUTS - No such file or folder


    There were some typos that were corrected but no result yet to compare.
      My Computer


  8. Posts : 31,622
    10 Home x64 (22H2) (10 Pro on 2nd pc)
       #8

    zbook said:
    C:\WINDOWS\system32>fc "Important commands and shortcuts.txt" "important web pages (1)" > differences.txt
    FC: cannot open IMPORTANT WEB PAGES (1) - No such file or folder
    There was no .txt extension for "important web pages (1)", was that correct? Also, unless both files are in the current directory C:\WINDOWS\system32 you will have to give the full path as well as the filename. eg. "C:\Users\zbook\temp\important web pages (1).txt"

    Why are you in system32 anyway? FC does not need an Admin command prompt.
      My Computers


  9. Posts : 30,591
    Windows 10 (Pro and Insider Pro)
       #9

    Try WinMerge
      My Computers


  10. Posts : 41,459
    windows 10 professional version 1607 build 14393.969 64 bit
    Thread Starter
       #10

    The files are on the desktop.
    For each file, file was clicked, then file save as.
    Whatever was displayed in the This PC > desktop was entered into command prompt.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 18:29.
Find Us




Windows 10 Forums