Match and Print the results in different files
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.
Below given is the model input files.
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.
|All times are GMT -5. The time now is 08:32 AM.|