Sign in to follow this  
Followers 0
myspacee

Find differences between 2 text files

9 posts in this topic

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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

I need this list to copy, move, rename lot of files.

m.

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Seems that it is reading the [] character as a TAB when this is generated is it using tab or @Crlf or r/n ?


[Cheeky]Comment[/Cheeky]

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Maybe it will be simpler to use external utils for comparing 2 files.

There are some freeware utilities for this also with commandline support:

PSPad, WinDiff, WinMerge

Share this post


Link to post
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
Sign in to follow this  
Followers 0