The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Comparing the common columns of a table in two files ragavhere SUN Solaris 1 04-11-2008 05:41 AM
Inserting New Line in File using Sed ?? Mary_xxx Shell Programming and Scripting 4 02-27-2008 12:50 PM
inserting line?? anj UNIX for Dummies Questions & Answers 7 11-03-2007 08:18 AM
Inserting character in every line dakid Shell Programming and Scripting 1 08-25-2006 04:54 AM
inserting characters before each line... Nicol Shell Programming and Scripting 4 09-02-2004 01:40 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-24-2008
Registered User
 

Join Date: Aug 2007
Location: Bangalore
Posts: 285
Stumble this Post!
comparing and inserting common line in other file

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.
Forum Sponsor
  #2 (permalink)  
Old 03-25-2008
era era is online now
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,631
Stumble this Post!
This is identical to Cut data and put it in next line
  #3 (permalink)  
Old 03-25-2008
Moderator
 

Join Date: Feb 2007
Posts: 1,929
Stumble this Post!
Quote:
Originally Posted by era View Post

So this thread is closed.
Google The UNIX and Linux Forums
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:17 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0