Jump to content

Recommended Posts

Posted

hi all i got 3 files

 

file 1 contains --> 1,2,3,4,5,6,7,8,9,10

file 2 contains --> 2,4,6,8,10,12,14,16

file 3 contains --> 2,8,10,20,21,22,23

 

how can i merge all 3 and have a messagebox display 1,2,3,4,5,6,7,8,9,10,12,14,16,20,21,22,23 without of course displaying the duplicate numbers amongst the files 2 or 3 times i just cant figure it out, all i got so far was to get 1,2,3,4,5,6,7,8,9,10,2,4,6,8,10,12,14,16,2,8,10,20,21,22,23

but how do i mix all 3 of them without displaying the same numbers 2-3 times ? cheers

Posted

You really should stick to one topic, as this one is really just a continuation of your earlier one, and the solution is along the lines of a similar method for removing duplicates.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Posted

Th only thing not mentioned in the previous topics is the final sorting  :)

#Include <Array.au3>

Local $txt = "3" &@crlf& "1" &@crlf& "2" &@crlf& "3 " &@crlf& "4" &@crlf& "41" &@crlf& "42" &@crlf& "3" &@crlf& "5" &@crlf& "6" &@crlf& "42"

;Local $txt = FileRead("1.txt") & @crlf & FileRead("2.txt") & @crlf & FileRead("3.txt")

Local $uniq = StringRegExp($txt, "(?s)\b(\d+)\b(?!.*\b\1\b)", 3)

; sorting numeric
Local $temp, $loop = 1
While $loop 
    $loop = 0
    For $i = 1 To UBound($uniq) - 1
        If Number($uniq[$i]) < Number($uniq[$i-1]) Then  ; sort ascending
            $temp = $uniq[$i]
            $uniq[$i] = $uniq[$i-1]
            $uniq[$i-1] = $temp
            $loop = 1
        EndIf
    Next
WEnd
_ArrayDisplay($uniq)
Msgbox(0,"", _ArrayToString($uniq, ", ") )

 

Posted

MIKELL I OWE YOU A BEER MAN !! make that many beers for once more he saves the day thanks a million !!!

 

this post is very different from other posts, if i could do it myself i wwouldn't be asking, the other posts have to do with numbers also but different stuff

thanks a lot especially mikell !

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
  • Recently Browsing   0 members

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