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: 470
command-line
|shell-scripting
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:tarun@gmail.com
Neeraj:neeraj@xyz.com
Rahul:rahul@gmail.com
what I'm trying to get is like:
Neeraj:149:neeraj@xyz.com
Rahul:148:rahul@gmail.com
Tarun:143:tarun@gmail.com
© Ask Ubuntu or respective owner