I have 2 text files default.txt and current.txt.
default.txt:
ab_abcdefghi_EnInP005M3TSub.csv FMR: 0.0009 FNMR: 0.023809524 SCORE: -4 Conformity: True
ab_abcdefghi_EnInP025M3TSub.csv FMR: 0.0039 FNMR: 0 SCORE: -14 Conformity: True
ab_abcdefghi_EnInP050M3TSub.csv FMR: 0.01989 FNMR: 0 SCORE: -18 Conformity: True
ab_abcdefghi_EnInP075M3TSub.csv FMR: 0.0029 FNMR: 0 SCORE: -17 Conformity: True
ab_abcdefghi_EnInP090M3TSub.csv FMR: 0.0002 FNMR: 0 SCORE: -7 Conformity: True
current.txt looks like this
ab_abcdefghi_EnUsP005M3TSub.csv FMR: 0.0041 FNMR: 0 SCORE: -14 Conformity: True
ab_abcdefghi_EnUsP025M3TSub.csv FMR: 0.00710000000000001 FNMR: 0 SCORE: -14 Conformity: True
ab_abcdefghi_EnUsP050M3TSub.csv FMR: 0.0287999999999999 FNMR: 0 SCORE: -21 Conformity: True
ab_abcdefghi_EnUsP090M3TSub.csv FMR: 0.0113 FNMR: 0 SCORE: -23 Conformity: True
What i need to do is to subtract values of current from default (default-current).
E.g:
FMR_DIFF = FMR(default) - FMR(test)
FNMR_DIFF = FNMR(default) - FNMR(test)
SCORE_DIFF = SCORE(default) - SCORE(test)
I need to output this in a text file with output looking something like this
O/P:
result: 005M3TSub FMR_DIFF: -0.0032 FNMR_DIFF: 0.023809524 SCORE_DIFF: 10
I am trying to do this in C#. So far i have tried reading lines in both files. I was able to compare them. I cannot comprehend the logic i need to implement. I am very new to programming. Any help is appreciated.
It is an interesting problem. Please check the solution. It is not optimized properly.
Firstly, we create a simple FileStructure Class to represent the String:
define the constant keyname for parsing .
Now, Parse the file and store the data in list structure.
To match the difference and get the defined result as per your question.
Call the following method.
Thanks, Ajit