Comparing Files

Hello all. Quick question.

I have to compare these 2 files and display the lines of one file that match a column in another file.

So I have 2 files both contain 3 fields. I want to compare the first field from the first file to the second file.

If there is a match I want to display the first second and third field on that file.

So one file contains a list of names and is compared with another file that contains a list of names and other stuff.

I am comparing a shorter amount of names with a longer list of names.

For instance I have to display the list of online users from a file that contains a list of all the users.

Thanks for your help.

File 1 would be online users file 2 would be list of all users. I want to display only online users. And file 1 is does not have a deliverer such as :
File 1

username1       anothercolum1  
username2       anothercolum2
username3      anothercolum3

File 2

username1:anothercolum2
username2:anothercolum2
username3:anothercolum3
username4:anothercolum2
username5:anothercolum2
username6:anothercolum3

output

username1      anothercolum2
username2      anothercolum2
username3      anothercolum3

You Are a GOD!!!! Thank you!!!!

Introuble99:
When asking for help with homework questions, you must fill out the entire template shown in: guidelines for posting homework

Please add a post to this thread with the entire template filled out!

vgersh99 and Isatenstein:
Please do not respond to homework issues if the homework form has not been included and filled out completely!

Thank You.

The UNIX and Linux Forums.

Hi ,

in my script i have a select query the output is very messy have to formatt it but i dont know the exact syntax can you guide me

x=user

column "column1" formatt a20
select * from table where column1 ='$X

is this correct

Please start a new thread for this.