On Wed, Dec 17, 2008 at 5:36 PM, ashok abraham <[email protected]> wrote:

>   i have my entire organisation adress book details stored in ldap format
> in a text file in the following manner
>
> dn: uid=rajendrat,ou=PUNE,dc=shapoorji,dc=com
> uid: rajendrat
> objectClass: top
> objectClass: person
> objectClass: inetOrgPerson
> ou: PUNE
> givenName: RAJENDRA
> sn: TEKADE
> cn: PUN/PROJ/RAJENDRA TEKADE
> mail: [email protected] <rajendra.tekade%40shapoorji.com>
> structuralObjectClass: inetOrgPerson
> entryUUID: 9025a420-5246-1029-867e-d0bf6fd95702
> creatorsName: cn=root,dc=shapoorji,dc=com
> createTimestamp: 20050506064813Z
> entryCSN: 20050506064813Z#000007#00#000000
> modifiersName: cn=root,dc=shapoorji,dc=com
> modifyTimestamp: 20050506064813Z
>
> dn: uid=abharsora,ou=Mumbai_RO,dc=shapoorji,dc=com
> uid: abharsora
> objectClass: top
> objectClass: person
> objectClass: inetOrgPerson
> ou: Mumbai_RO
> givenName: A B
> sn: HARSORA
> cn: MUM/PROJ/A B HARSORA
> mail: [email protected] <abharsora%40shapoorji.com>
> structuralObjectClass: inetOrgPerson
> entryUUID: d2ce9ba0-5247-1029-89e6-d0bf6fd95702
> creatorsName: cn=root,dc=shapoorji,dc=com
> createTimestamp: 20050506065715Z
> entryCSN: 20050506065715Z#000001#00#000000
> modifiersName: cn=root,dc=shapoorji,dc=com
> modifyTimestamp: 20050506065715Z
>
> dn: uid=kiran.pandhe,ou=PUNE,dc=shapoorji,dc=com
> uid: kiran.pandhe
> objectClass: top
> objectClass: person
> objectClass: inetOrgPerson
> ou: PUNE
> givenName: KIRAN
> sn: PANDHE
> cn: PUN/PROJ/KIRAN PANDHE
> mail: [email protected] <kiran.pandhe%40shapoorji.com>
> structuralObjectClass: inetOrgPerson
> entryUUID: 44688328-5632-1029-8e53-b130c14697bd
> creatorsName: cn=root,dc=shapoorji,dc=com
> createTimestamp: 20050511063301Z
> entryCSN: 20050511063301Z#000001#00#000000
> modifiersName: cn=root,dc=shapoorji,dc=com
> modifyTimestamp: 20050511063301Z
>
> if i want to get the email adress of all the person in a particular region
>
> i will do a grep for that region like
>
> grep "PUN" filename
>
> i will get result like
>
> cn: PUN/PROJ/RAJENDRA TEKADE
> cn: PUN/PROJ/KIRAN PANDHE
>
> but my actual email id lies just below the cn
>
> any idea to get one line next to search result pattern line
>
> in my eaxample
>
> Add more friends to your messenger and enjoy! Go to
> http://messenger.yahoo.com/invite/
>
>  
>

Hi,

     Instead of grep PUN you should grep mail like this;

    #grep mail yourfilename -r

it will give u result like this

mail: [email protected]
mail: [email protected]
mail: [email protected]

-- 
Have a nice time,
Gourav Joshi


[Non-text portions of this message have been removed]

Reply via email to