Jump to content
Sign in to follow this  
kashmar

duplicated line ?

Recommended Posts

kashmar

Hi.

I'm have a file that containes around 45 lines , some are exactly the same . example :

line 1 087733445

line 2 A55224689

line 3 087733445

line 4 F44522652

what i am triyng to do is check if a certain line exists 2 or more times in this file.

i think it can be done be filereadline and then puting that line in an array, but i am still confused and don't know how to do this .

can somebody help me plz ??

Share this post


Link to post
Share on other sites
Jos

Should work fine for smaller files:

#Include<File.au3>
Dim $InputRecords
_FileReadToArray("Test.txt",$InputRecords)
For $x = 1 to $InputRecords[0]
    For $y = 1 to $x-1
        If $InputRecords[$x] = $InputRecords[$y] Then
            ConsoleWrite("Record " & $x & " is a duplicate of record " & $y & @LF)
        EndIf
    Next
Next

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
kashmar

Excellent thanks a lot JdeB

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  

×