Jump to content

Find differences between 2 text files


Recommended Posts

hello to all,

try to understand how find differences between 2 attached text files:

both are create from a procedure, but sometime @LF is correct, sometime is identified as a small square.

Try _FileCountLines, stinginstr, without luck.

If you open files with notepad you can see differences, but can't script a way to find differences.

Anyone can solve this mistery?

Thank you,

m.

Link to comment
Share on other sites

What do you want to do? Find the diffs and then?

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

The difference is that file A is coded with a linefeed (0x0A) and file B is coded with carriage return + linefeed (0x0D plus 0x0A) as required by windows.

Have a look at function "StringAddCR". This adds the "missing" carriage return character. If you read file A, use StringAddCr and rewrite the file then file A should be equal to file B.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Thank you all for attention,

water thank you for info, but i must decide which is A type and B type file, before act with a script.

lordicast sorry but can't understand your info request.

any other idea ?

m.

Link to comment
Share on other sites

you could use this stringregexp to get the values.

'PVV\d*P\s\w{6}\s\d*'

this will work for your posted text file..... but dont know how different (flexible) your other text files will be.

Edited by Aceguy
Link to comment
Share on other sites

water thank you for info, but i must decide which is A type and B type file, before act with a script.

To determine the type of file just read x bytes from the file (x > longest line in file. 200 bytes in the example) and search for the carriage return character
#Include <String.au3>
$sText = FileRead("C:\TEMP\A.TXT",200)
If StringInStr($sText,_HexToString("0D")) = 0 Then
    ConsoleWrite("Carriage Return not Found" & @CRLF) 
Else
    ConsoleWrite("Carriage Return Found" & @CRLF) 
EndIf

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...