Match File and Copy File Script (Homework, Closed)

Can you please help on this?

I am looking for the shell script which does following:-

step 1: It should open the file /u/manish/input/FileIndex.dat and read line by line

step 2: Once first line is read \(for ex: File1\), we have to find a file, that contains this matching filename in the data directory.
        
step3: if the matching filename is found in the  /u/manish/data directory,
 step4: These selected files are to be 'copied' to the /u/manish/output  directory.

step5: back to step1, for reading the second and subsequent lines in the /u/manish/input/FileIndex.dat file.

Thank you

file=/tmp/t1

while read files
do
    if [ -f $files ];then
        echo $files
        # do the copy operation here
    fi    
done < $file

This looks like homework to me.

Is it really a homework?
If not,
 am sorry about the wrong assumption
 please do show us what you have tried so far
If yes,
 please read the rules, there is a separate sub-section dealing with this.

Hello,

Per our forum rules, all threads must have a descriptive subject text. For example, do not post questions with subjects like "Help Me!", "Urgent!!" or "Doubt". Post subjects like "Execution Problems with Cron" or "Help with Backup Shell Script".

The reason for this is that nearly 95% of all visitors to this site come here because they are referred by a search engine. In order for future searches on your post (with answers) to work well, the subject field must be something useful and related to the problem!

In addition, current forum users who are kind enough to answer questions should be able to understand the essence of your query at first glance.

So, as a benefit and courtesy to current and future knowledge seekers, please be careful with your subject text. You might receive a forum infraction if you don't pay attention to this.

Thank you.

The UNIX and Linux Forums

Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

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

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.