Hi all,
I have list of two kind of files and I want to compare the rows and print the merged data by applying if condition.
First kind of file looks like:
Quote:
6 TRP 5 LEU 3.800394
6 TRP 7 GLN 3.837793
12 THR 11 VAL 3.794017
12 THR 13 ILE 3.787175
12 THR 14 LYS 7.014680
12 THR 15 ILE 10.132971
98 ASN 97 LEU 3.807972
98 ASN 99 PHE 3.811863
99 PHE 1 PRO 14.907668
and second kind of file looks like :
Quote:
6 TRP 5 LEU 3.800394
12 THR 13 ILE 3.787175
22 ALA 21 GLU 3.800398
41 ARG 40 GLY 3.790884
98 ASN 97 LEU 3.807972
60 ASP 59 TYR 3.807268
I want to print the rows present in second file followed by 3 more columns from first file by applying if condition
if (3rd column = 1st column
- 1) #from second file
compare it in first file and
print 3rd, 4th and 5th column from the row having (column1 in frist file=
column1 in second file && 3rd column = 1st column
+1 ) # in first file
and vive versa....
i.e, if (3rd column = 1st column
+ 1)
then print 3rd, 4th and 5th column from the row having (column1 in first file= column1 in second file && 3rd column = 1st column
- 1 ) # in first file
therefore, the expected output must be like:
Quote:
6 TRP 5 LEU 3.800394 7 GLN 3.837793
12 THR 13 ILE 3.787175 14 LYS 7.014680
98 ASN 97 LEU 3.807972 99 PHE 3.811863
Thanks in advance !!!!!