Problem with grep command options in Sunsolaris

Hi Experts

I need the following output from grep command of Sunsolaris on a set of input files.

Output:........
1st search string from file1
2nd search string from file1
3rd search string from file1
1st search string from file2
2nd search string from file2
3rd search string from file2
1st search string from file3
2nd search string from file3
3rd search string from file3 and so on from the last file.

I mean here I need the first 3 lines from each file which matches with the keyword of grep.

Incase if awk or sed command(s) can do the same, please provide that script also.

Thanks in advance...
Sidda

one way:

for i in file*
do
   grep 'pattern' $file | head -3
done > resultfile

Hi Jim and all

By mistake I gave a different output in my query post. I am extremely sorry over this.
Actually I need the following output:

file1:1st search string from file1
file1:2nd search string from file1
file1:3rd search string from file1
file2:1st search string from file2
file2:2nd search string from file2
file2:3rd search string from file2
file3:1st search string from file3
file3:2nd search string from file3
file3:3rd search string from file3 and so on from the last file.

i.e. I need the file name name also in the output, this is very crucial for me because my file name is my sample
name.

Thanks

How can this be crucial ...
Looks too much like homework to me. You will learn better by reading the grep manual page than having your work done by other people.