Suppose we have two files
one file
FAAA_HUMAN.input1
2
5
7
11
and another file
FAAA_HUMAN.output
M*0.0540*0.0039*0.2212*0.0082*0.0020*0.0137*0.0028*0.0029*0.2198*0.0104*0.0889*0.0282*0.0049*0.0804*0.1743*0.0215*0.0531*0.0071*0.0007*0.0021*0.7270*2.5000*
S*0.0197*0.0043*0.0037*0.0032*0.0018*0.0039*0.0015*0.0027*0.0030*0.0039*0.0012*0.2281*0.0025*0.0022*0.0027*0.6511*0.0586*0.0040*0.0005*0.0016*0.3700*2.5000*
F*0.0029*0.0008*0.0021*0.0026*0.2621*0.0025*0.2339*0.0018*0.0023*0.0033*0.0010*0.0022*0.0017*0.0024*0.0024*0.0028*0.0023*0.0023*0.4673*0.0015*0.4240*2.5000*
I*0.0046*0.0012*0.2219*0.0020*0.0069*0.0024*0.0055*0.1693*0.0020*0.2029*0.0021*0.0014*0.0019*0.0014*0.0018*0.0025*0.0029*0.3649*0.0006*0.0018*0.5222*2.5000*
P*0.0515*0.0014*0.0849*0.0630*0.0027*0.2258*0.0282*0.0076*0.0126*0.0135*0.0016*0.0183*0.0637*0.0732*0.0176*0.2021*0.0568*0.0655*0.0011*0.0091*0.7958*2.5000*
V*0.3128*0.0031*0.0190*0.0029*0.2206*0.0070*0.0015*0.1142*0.0109*0.0096*0.0028*0.0022*0.0083*0.0021*0.0026*0.0205*0.0171*0.2189*0.0010*0.0231*0.6230*2.5000*
A*0.0941*0.0018*0.0247*0.0222*0.2207*0.0252*0.0084*0.0047*0.0062*0.0079*0.0020*0.2878*0.2066*0.0039*0.0051*0.0547*0.0136*0.0061*0.0012*0.0032*0.6645*2.5000*
E*0.0993*0.0014*0.0975*0.3559*0.0030*0.0988*0.0057*0.0042*0.0914*0.0130*0.0021*0.0120*0.0475*0.0277*0.0190*0.0762*0.0294*0.0119*0.0011*0.0027*0.7241*2.5000*
D*0.0790*0.0014*0.1773*0.0207*0.0025*0.0465*0.1021*0.0027*0.0151*0.0074*0.0015*0.1091*0.0950*0.0147*0.0077*0.0723*0.2283*0.0040*0.0010*0.0117*0.7629*2.5000*
S*0.0337*0.0919*0.0055*0.0059*0.0034*0.0201*0.0194*0.0050*0.0055*0.0078*0.0023*0.0101*0.0589*0.0039*0.2287*0.3931*0.0941*0.0069*0.0011*0.0029*0.6322*2.5000*
D*0.0074*0.0008*0.5185*0.0237*0.0015*0.0077*0.0809*0.0020*0.0038*0.0034*0.0009*0.0084*0.0960*0.0102*0.0029*0.2229*0.0041*0.0027*0.0005*0.0015*0.5000*2.5000*
F*0.0029*0.0007*0.0021*0.0026*0.7291*0.0025*0.0019*0.0018*0.0022*0.0033*0.0010*0.0022*0.0017*0.0023*0.2344*0.0028*0.0022*0.0022*0.0006*0.0014*0.2651*2.5000*
P*0.0090*0.0010*0.0049*0.0061*0.0025*0.0055*0.0019*0.0038*0.0054*0.2186*0.0015*0.0033*0.5570*0.0031*0.0043*0.1334*0.0306*0.0053*0.0008*0.0021*0.4543*2.5000*
I*0.0037*0.0010*0.0017*0.0021*0.0042*0.0024*0.0009*0.4114*0.0021*0.3121*0.0034*0.0015*0.0018*0.0016*0.0019*0.2273*0.0024*0.0117*0.0007*0.0063*0.4469*2.5000*
H*0.1051*0.0007*0.0031*0.2746*0.0014*0.0027*0.0798*0.0018*0.0120*0.0102*0.0010*0.0595*0.0019*0.4283*0.0027*0.0031*0.0025*0.0024*0.0006*0.0063*0.5353*2.5000*
So ,we want to have output
where from first file is having number and then use second file accordingly
it wil print
S*0.0197*0.0043*0.0037*0.0032*0.0018*0.0039*0.0015*0.0027*0.0030*0.0039*0.0012*0.2281*0.0025*0.0022*0.0027*0.6511*0.0586*0.0040*0.0005*0.0016*0.3700*2.5000*
P*0.0515*0.0014*0.0849*0.0630*0.0027*0.2258*0.0282*0.0076*0.0126*0.0135*0.0016*0.0183*0.0637*0.0732*0.0176*0.2021*0.0568*0.0655*0.0011*0.0091*0.7958*2.5000*
A*0.0941*0.0018*0.0247*0.0222*0.2207*0.0252*0.0084*0.0047*0.0062*0.0079*0.0020*0.2878*0.2066*0.0039*0.0051*0.0547*0.0136*0.0061*0.0012*0.0032*0.6645*2.5000*
D*0.0074*0.0008*0.5185*0.0237*0.0015*0.0077*0.0809*0.0020*0.0038*0.0034*0.0009*0.0084*0.0960*0.0102*0.0029*0.2229*0.0041*0.0027*0.0005*0.0015*0.5000*2.5000*
#!/usr/bin/perl -w
open(LIST,"FAAA_HUMAN.input1");
@list=<LIST>;
close(LIST);
open(NEW,"> OUTPUT_txt");
{
#print "$file\n";
#open(RONALDO,"/home/Raja/MORE_DISEASE_HUMAN_ALIGNMENT/WORK/OUTPUT_FILE/$file");
open (RONALDO,"FAAA_HUMAN.output");
@outputfile=<RONALDO>;
close(RONALDO);
foreach $x(@list)
{
foreach $y(@outputfile)
{
system "cat $y|awk -v num=$x '{if(NR==num) print($0);}' ";
}
}
}
close(DIR);
close(NEW);
exit;
what can be possible solution?