Match and Print the results in different files
Hi
I am having 2 txt file, one with 199 ids eg..00010,00051 etc and the second with some information regarding this ids...Now i wanna match this 199 ids one by one and print the matched lines in individual files ie. 199 files. pls reply me asap |
Please provide a sample of the files content. And what you have tried so far.
I am assuming that the ID is contained in both files, if so you need to read the ID's from the first file into an array and scan the second file for each array entry. |
Moved: This thread is more suitable in Programming and has been moved accordingly to help your thread/question get the exposure it deserves.
|
Hi
Below given is the model input files. input 1 00010 00020 00030 00040 00051 00052 00053 00500 00530 00520 00620 00630 00640 00650 00562 input 2 Q5ST30 hsa00290 hsa00970 2 P42336 hsa00562 hsa04012 hsa04370 hsa04630 hsa04070 hsa04150 hsa04810 hsa04210 hsa04510 hsa04910 hsa04620 hsa04650 hsa04660 hsa04662 hsa04664 hsa04670 hsa05200 hsa05210 hsa05212 hsa05214 hsa05221 hsa05220 hsa05218 hsa05211 hsa05215 hsa05213 hsa05222 hsa05223 hsa04930 29 |
There doesn't appear to be any corelation between the contents of file1 and file2.
Assuming that the files are "known" to contain good data (always a hell of an assumption) and the first file contains the IDs and the second contains the information about the IDs (in a 1-1 ratio, therefore your information must always be a single line) You could read the first file into an array, read the second file into another array, loop through the array's and create your files... I would suggest Perl for this, but I'm sure someone will have a way of doing something clever in Awk. Perl Script: Code:
#!/usr/bin/perl |
All times are GMT -5. The time now is 09:29 AM. |