1. First get all unique genenames (g1,g2.....g8).
2. Then look if that particular gene is present in any of the columns in the input file.
3. If it is present, print 1. If absent, print 0.
1. Please note that the each of the columns (Set1,Set2,Set3) in input.txt can have missing values(last two records in input.txt).
2. The columns are not always three. My actual input file has 7. So I want the column counts to be dynamic.
This User Gave Thanks to jacobs.smith For This Post:
If you are not bothered about sequence of field 1st as per your Input_file then following may help you in same.
Output will be as follows.
In case you need output into same order as per Input-file(sorted order) then following may help you in same.
Output will be as follows. EDIT: Adding a non-one liner form of solutions here.
Last edited by RavinderSingh13; 08-18-2016 at 02:59 PM..
Reason: Added non-one liner form of solutions now.
This User Gave Thanks to RavinderSingh13 For This Post: