explaining the selection logic (in 2 words or less) would help all of us!
also using the vB Codes when quoting the input files - could simplify the description.
say one file is
1 5 positions denotes from 1 to 5
ASERF
12424
21342
where 12424 is just below their ASERF
and 21432 is just below 12424
another file is like numbers
2
3
4
that is position number
So at position number 2 is S 2 1
similarly at position 3 is E 4 3
similiarly at position 4 is R 2 4
awk 'NR == FNR { x[$1]; next }
NF {
for ( i in x )
x = x ? x " " $i : $i
} END {
for ( j in x )
print j, x[j]
}' file2 file1
$ cat file1
1 8
A G H H H U I O
22 33 44 55 32 53 4 55
$ cat file2
2
4
6
$ nawk 'NR == FNR { x[$1]; next }
NF {
for ( i in x )
x = x ? x " " $i : $i
}END{
for ( j in x )
print j, x[j]
}' file2 file1
2 8 G 33
4 H 55
6 U 53
I'm not sure about the requirement,
but if the output should be really as shown:
$ nawk 'NR == FNR { x[$1]; next }
NF > 2 {
for ( i in x )
x = x ? x " " $i : $i
}END{
for ( j in x )
print j, x[j]
}' file2 file1
2 G 33
4 H 55
6 U 53