awk problems

awk ' FILENAME=="First"{
arr[$1] = 1;
x=sub[$2] ;
}
FILENAME=="Second"{
if (/^10/ && arr[substr($0,31,5)]){
sub(substr($0,4,5),$x,$0);
print $0 ;
}
}
' First Second

the problem that I want to access the VAR X from the first file to modify the second file if the (IF expression is true)

the first problem :how can we solve this

the second problem : if we have several files as the second but the first is fixed how can we get the files automatically

here is an example of the files

the first file:
04756 23644
02565 25696
25698 25693

the second files:
10023658702365970000236587000204756
20002655000002365900000255
10002365000002365000002566900000225

thanks in advance

can any body feed me if its possible or not;

the idea from this program is to make match between the two files by using the first field from the first file
and after match make some modify by using the second field from the first file

as the example above the bold number in the first file (first field) must match the last bold number on the second file and if its match modfy the second file depending on the second field on the first file

regards
i hope i will recieved any respond

You could find a very similar thread here

Please read the rules of the forum :slight_smile:

Do not bump up questions !

I can understand the first block of your requirement.

But from where does this number - 23658 come from ?