View previous topic :: View next topic
|
Author |
Message |
Cprasad
New User
Joined: 22 Apr 2010 Posts: 2 Location: India
|
|
|
|
I have 2 files the 1st file length is 150 & 2nd one is 80.
Ex of File 1 :-
Code: |
Chandu A 123456789 134578978 testing cmpny xxxxxx
SAM A 888888888 134578978 testing cmpny xxxxxx
RAM L 123456789 134578978 testing cmpny xxxxxx
Pooh L 878787878 134578978 testing cmpny xxxxxx
|
Ex of File 2 :-
Code: |
L 123456789 134578978
A 888888888 134578978
A 123456789 134578978
L 878787878 134578978
|
The Requirement is combination (A 123456789 134578978) of File1 should be compared with combination (A 3456789 134578978) of File2 if matched it shud be written to 3rd file and if only two values (combination (123456789 134578978) are matched and there is discripenct in the 3rd value ( A or L) we need to replace the same value of the first file with value of the 2nd file and wriiten to the 3rd file.
In breif,
Ex of File 1 :-
Code: |
Chandu A 123456789 134578978 testing cmpny xxxxxx |
Ex of File 2 :-
Code: |
L 123456789 134578978 |
Out put shd look like
Code: |
Chandu L 123456789 134578978 testing cmpny xxxxxx
(we can see tht A is changed to L)
SAM A 888888888 134578978 testing cmpny xxxxxx
RAM L 123456789 134578978 testing cmpny xxxxxx
Pooh L 878787878 134578978 testing cmpny xxxxxx |
|
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Cprasad wrote: |
discripenct |
Huh?
Between the shorthand and the mis-spellings, your post is somewhat confusing, care to try again? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello and welcome to the forum,
Might "discripenct" be discrepancy or simply "difference"?
Suggest you use the spellcheck (just below the reply text box) to make sure that the typos are minimized. |
|
Back to top |
|
|
Cprasad
New User
Joined: 22 Apr 2010 Posts: 2 Location: India
|
|
|
|
Sorry for the Confusion.
File1:- F1
A dis 23456 7890 xxxx testing
A ram 5678 9870 yyyy coding
B sam 1234 3456 zzzz analysis
B cam 9998 8989 dfdf xyzxyz
File2:- F2
A 23456 7890
X 5678 9870
B 1234 3456
Y 9998 8989
File3:- output
A dis 23456 7890 xxxx testing
X ram 5678 9870 yyyy coding ------> A is replaced with X
B sam 1234 3456 zzzz analysis
Y cam 9998 8989 dfdf xyzxyz ------> B is replaced with Y
Requirement is
We need to compare F1 - 1,3,4 columns with F2- 1,2,3 coulmns, if matched we need we need to write that record as
it is to the output file. Suppose if the F1 1st column doesn't match with F2 1st column & other 2 columns of
two files are matched, then F1 1st cloumn value needs to be replaced with F2 1st column & written to the o/p file. |
|
Back to top |
|
|
|