abhikalrt53 has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I have started to learn perl but now I am completely stuck in this problem, thus I seek your help.
I have seven files with different number ranges. I want to compare their ranges and detect the common range from them. Below I have shown an example with three files (file1.txt, file2.txt anf file3.txt). These files are like:
file1.txt:
68476204: 9-50, 55-75, 80-132 NC_23987: 2-22, 1001-1085 68473073: 1-8 68485121: 1-10, 20-55
file2.txt:
68485121: 15-45 45905121: 2-98, 201-255 68476204: 8-30, 57-77, 88-180 NC_23987: 1-18, 1021-1055 68473073: 14-44
file3.txt:
68485121: 16-42 68476204: 8-22, 55-76, 81-118
From here, I want to generate two output. First one is the common ranges (common in all three) after matching left column value(which are common in all three of them). For the above input, my output1.txt will be:
68485121: 20-42 68476204: 9-22, 57-75, 88-118
The second output (output2.txt) contain only those ranges those are >=15. Here, the output2.txt will be:
68485121: 20-42 68476204: 57-75, 88-118
Any type of suggestion is appreciated.
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Intermediate range calculation from files
by BrowserUk (Patriarch) on Aug 31, 2016 at 08:31 UTC | |
|
Re: Intermediate range calculation from files
by choroba (Cardinal) on Aug 31, 2016 at 12:47 UTC | |
|
Re: Intermediate range calculation from files
by Anonymous Monk on Aug 31, 2016 at 07:44 UTC | |
|
Re: Intermediate range calculation from files
by GotToBTru (Prior) on Aug 31, 2016 at 12:20 UTC | |
|
Re: Intermediate range calculation from files
by haukex (Archbishop) on Sep 02, 2016 at 12:50 UTC |