Need to build Shell Script to search content of a text file into a folder consist several files

Have to read one file say sourcefile containing several words and having another folder containing several files.

Now read the first word of Sourcefile & search it into the folder consisting sevral files, and create another file with result. We hhave to pick the filename of the file in which we have that word and the linenumber.

Outputfile format:
Filename Word Linenumber

Samething we have to do for all words. We can have same word in a single file multiple times and need to pick all line numbers.

---------- Post updated at 03:04 PM ---------- Previous update was at 01:32 PM ----------

Guys kindly help me to get the resolution. I am trying hard.

Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future

Thank You.

The UNIX and Linux Forums.

$ cat f1
toto
titi
$ cat f2
jfdklsjfkldsq
jfdklsjfkldsq
toto
jfdklsjfkldsq
toto titi toto titi
jfdklsjfkldsq
titi
jfdklsjfkldsq
$ cat f3
toto
jfdklsjfkldsq
toto titi toto titi
jfdklsjfkldsq
titi
$ nawk 'NR==FNR{a[++c]=$0;next}{for(i in a) {if (match($0,a)) print FILENAME,a,FNR };next}' f1 f2 f3
f2 toto 3
f2 toto 5
f2 titi 5
f2 titi 7
f3 toto 1
f3 toto 3
f3 titi 3
f3 titi 5

also

$ nawk 'NR==FNR{a[++c]=$0;next}{d=1;do{if (match($0,a[d])) print FILENAME,a[d],FNR}while(++d in a);next}' f1 f2 f3
f2 toto 3
f2 toto 5
f2 titi 5
f2 titi 7
f3 toto 1
f3 toto 3
f3 titi 3
f3 titi 5

First of all many thanks for providing the solution.
The code is working fine and giving the required output.

Here we have three files f1, f2 & f3 and we got the output at console.

As per my requirement I need to search in all files present in any specific folder and the search results need to be stored in another text file.

---------- Post updated at 04:40 PM ---------- Previous update was at 04:03 PM ----------

now getting the exact output...
lets say sourcefile is f1 and all destination files are starting with ff.

$ nawk 'NR==FNR{a[++c]=$0;next}{d=1;do{if (match($0,a[d])) print FILENAME,a[d],FNR}while(++d in a);next}' f1 ff* >> result

so final output stored in filename result.