compare a string in two files

Posted by Tarun on Ask Ubuntu See other posts from Ask Ubuntu or by Tarun
Published on 2014-08-21T05:55:09Z Indexed on 2014/08/21 10:30 UTC
Read the original article Hit count: 453

I am trying to get the name of the user from one file and their corresponding details from my other file.

I use the command

awk -F : '{ print $1 }' user-name

it gives me the list of all the user's. So now how can I match these names with the other file and get a output like:

user-name id contact-details

The format of the two files is like follows:

1.user-name

Tarun:143
Rahul:148
Neeraj:149

2.user-details

Tarun:[email protected]
Neeraj:[email protected]
Rahul:[email protected]

what I'm trying to get is like:

Neeraj:149:[email protected]
Rahul:148:[email protected]
Tarun:143:[email protected]

© Ask Ubuntu or respective owner

Related posts about command-line

Related posts about shell-scripting