Hi,

I have two files--

file1-


Quote:
dn: cn=Anandmohan Singh,ou=addressbook,dc=thbs,dc=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
cn: Anandmohan Singh
givenName: Anandmohan
mail: anand_ms@thbs.com
mobile: 9986010455
ou: null
physicalDeliveryOfficeName: ST-6th Floor
sn: Singh
telephoneNumber: 41827200 Extn: 7400
title: Associate Software Engineer - Trainee
uid: 1432

dn: cn=Riteshkumar Mohanty,ou=addressbook,dc=thbs,dc=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
cn: Riteshkumar Mohanty
givenName: Riteshkumar
mail: ritesh_m@thbs.com
mobile: 9916953109
ou: null
physicalDeliveryOfficeName: ST-6th Floor
sn: Mohanty
telephoneNumber: 41827200 Extn: 7400
title: Associate Software Engineer - Trainee
uid: 1418

file2:-


Quote:
uid:Password
0050:thbs
1418:thbs
1432:thbs

i have to compare two files and where the uid is same i have to take the password and insert it above the telephone number.

the output should be like this--

uid : 1418 common so insert the password thbs above the line telephonenumber.

Hey There,

What have you got so far? You should be able to grep the uid/pwd line out of the second file and use awk or sed to insert the necessary line (perhaps use awk to do it all - for the millions of people who are better at using awk than I am :)

, Mike

I am not familiar with awk and very little knowledge of sed i have.So i need help of you guys.

Thanks..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.