Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Comparing Email Addresses
#1
I have two list of email address saved as text files. I need to compare the files and delete duplicate names. How is this accomplish in QM?

Thanks
Liza
#2
Macro Macro1552
Code:
Copy      Help
str file1="$desktop$\test1.txt"
str file2="$desktop$\test2.txt"
str file3="$desktop$\test3.txt" ;;destination file. The macro creates it.

;------------------

str sf1.getfile(file1) sf2.getfile(file2)
ARRAY(str) a1(sf1) a2(sf2)
int i1 i2

for i2 0 a2.len ;;for each line in sf2
,;is this line in sf1?
,str& s=a2[i2]
,int found=0
,for i1 0 a1.len ;;for each line in sf1
,,if(matchw(a1[i1] s 1)) found=1; break
,;if not, add to sf1
,if(!found) sf1.addline(s)

;out sf1

sf1.setfile(file3)
#3
That was awsome!

Thank you very much
Liza
#4
This is not working as I hoped it would. Let me make an example, maybe I did not explain it well.

file1: master list
Steve Jobs
Halle Berry
Lauren Graham
Catherine Zeta
Beyonce
Uma Thurman


file2: new list
Beyonce
Halle Berry
Elvis Presley
Tom Jones


file3: end result file
Elvis Presley
Tom Jones
#5
Macro compare 2 files and delete duplicate lines
Code:
Copy      Help
str file1="$desktop$\test1.txt"
str file2="$desktop$\test2.txt"
str file3="$desktop$\test3.txt" ;;destination file. The macro creates it.

;------------------

str sf1.getfile(file1) sf2.getfile(file2)
ARRAY(str) a1(sf1) a2(sf2)
int i1 i2

sf1=""
for i2 0 a2.len ;;for each line in sf2
,;is this line in sf1?
,str& s=a2[i2]
,int found=0
,for i1 0 a1.len ;;for each line in sf1
,,if(matchw(a1[i1] s 1)) found=1; break
,;if not, add to sf1
,if(!found) sf1.addline(s)

;out sf1

sf1.setfile(file3)
#6
Thank you, thank you...you rock!

Liza


Forum Jump:


Users browsing this thread: 1 Guest(s)