vietboy505
March 1st, 2006, 08:39 AM
Compare two files and output the difference in a new file?
nameList.txt
| | |AAAAAAA* | |* | |9999| |MEP | |- | |XXXXXXXXX| | |
| | |AAAAAAA* | |* | |9999| |MEP | |- | |XXXXXXXXX| | |
| | |CCCCCCC* | |* | |9999| |NAD | |- | |XXXXXXXXX| | |
| | |CCCCCC D* | |* | |9999| |BEM | |- | |XXXXXXXXX| |YYYYY|
| | |XXXXXX A* | |* | |9999| |MEP | |- | |XXXXXXXXX| | |
| | |ZZZZZZ A* | |* | |9999| |NAD | |- | |XXXXXXXXX| | |
| | |EEASAW A* | |* | |9999| |NA* | |- | |XXXXXXXXX| |YYYYY|
| | |ASCAWF W A* | |* | |9999| |ME* | |* | |XXXXXXXXX| | |
| | |XXXXXX A A* | |* | |9999| |BE* | |* | |XXXXXXXXX| | |
| | |AWSDAW* | |* | |9999| |ME* | |- | |XXXXXXXXX| | |
| | |WFCAPI A2* | |* | |9999| |MEP | |- | |XXXXXXXXX| | |
checkList.txt
1 XXXXXXX 6 6 U 1 2 3 4 5 6 1 1 P 1 0 1 0
2 AAAAAAA -12 11 Y 1 2 3 4 5 6 469.7 481.7 P 1 0 1 0
3 FASZFAS -12 -6 Z 1 2 3 4 426.4 431.7 Z 0 0 1 0
4 JJHJHGC -12 12 Y 1 2 3 4 5 6 446.5 457.6 P 1 1 1 0
5 JHGJHZA -9 -4 Z 1 2 3 4 405.6 410.7 Z 0 0 1 0
6 7843JHE -8 8 Y 1 2 3 4 5 6 446.5 457.6 P 1 0 1 0
7 NMHZJYA -12 12 Y 1 2 3 4 5 6 446.5 457.6 P 1 1 1 0
8 WFCAPI -8 8 Y 1 2 3 4 5 6 446.5 457.6 P 1 0 1 0
9 FASTYTA -8 8 Y 1 2 3 4 5 6 446.5 457.6 P 1 0 1 0
10 89QANJGA -14 -7 Z 1 2 3 405.6 410.7 Z 0 0 1 0
I was wondering how I can do this by passing nameList.txt in array, probably with AAAAAAA or ASCAWF, begin third characters.
Then grab the second file, checkList.txt, on text such as FASZFAS or NAETGNA, second column.
Then if array in checkList.txt doesn't match with nameList.txt, output that name to a new file.
This will keep on doing until the end of file and keep on appending the name to the same new file.
Functions I probably need to use is:
open()
close()
while loop
compare method
Can any one help me started?
nameList.txt
| | |AAAAAAA* | |* | |9999| |MEP | |- | |XXXXXXXXX| | |
| | |AAAAAAA* | |* | |9999| |MEP | |- | |XXXXXXXXX| | |
| | |CCCCCCC* | |* | |9999| |NAD | |- | |XXXXXXXXX| | |
| | |CCCCCC D* | |* | |9999| |BEM | |- | |XXXXXXXXX| |YYYYY|
| | |XXXXXX A* | |* | |9999| |MEP | |- | |XXXXXXXXX| | |
| | |ZZZZZZ A* | |* | |9999| |NAD | |- | |XXXXXXXXX| | |
| | |EEASAW A* | |* | |9999| |NA* | |- | |XXXXXXXXX| |YYYYY|
| | |ASCAWF W A* | |* | |9999| |ME* | |* | |XXXXXXXXX| | |
| | |XXXXXX A A* | |* | |9999| |BE* | |* | |XXXXXXXXX| | |
| | |AWSDAW* | |* | |9999| |ME* | |- | |XXXXXXXXX| | |
| | |WFCAPI A2* | |* | |9999| |MEP | |- | |XXXXXXXXX| | |
checkList.txt
1 XXXXXXX 6 6 U 1 2 3 4 5 6 1 1 P 1 0 1 0
2 AAAAAAA -12 11 Y 1 2 3 4 5 6 469.7 481.7 P 1 0 1 0
3 FASZFAS -12 -6 Z 1 2 3 4 426.4 431.7 Z 0 0 1 0
4 JJHJHGC -12 12 Y 1 2 3 4 5 6 446.5 457.6 P 1 1 1 0
5 JHGJHZA -9 -4 Z 1 2 3 4 405.6 410.7 Z 0 0 1 0
6 7843JHE -8 8 Y 1 2 3 4 5 6 446.5 457.6 P 1 0 1 0
7 NMHZJYA -12 12 Y 1 2 3 4 5 6 446.5 457.6 P 1 1 1 0
8 WFCAPI -8 8 Y 1 2 3 4 5 6 446.5 457.6 P 1 0 1 0
9 FASTYTA -8 8 Y 1 2 3 4 5 6 446.5 457.6 P 1 0 1 0
10 89QANJGA -14 -7 Z 1 2 3 405.6 410.7 Z 0 0 1 0
I was wondering how I can do this by passing nameList.txt in array, probably with AAAAAAA or ASCAWF, begin third characters.
Then grab the second file, checkList.txt, on text such as FASZFAS or NAETGNA, second column.
Then if array in checkList.txt doesn't match with nameList.txt, output that name to a new file.
This will keep on doing until the end of file and keep on appending the name to the same new file.
Functions I probably need to use is:
open()
close()
while loop
compare method
Can any one help me started?