Berkeley CSUA MOTD:Entry 44842
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/05/24 [General] UID:1000 Activity:popular
5/24    

2006/10/17 [Science/Electric, Computer/SW/Unix] UID:44842 Activity:nil
10/17   sed/unix script help.
        I am trying to modify ldif file so i can actually import it to
        my directory server (SunOne).  My current ldif files, each entry
        start with the following:
        dn: cn=firstN LastN, mail=abc@xyz.org

        What I need, is change it to
        dc: cn=firstN LastN, dc=foo,dc=bar,dc=com

        where dc=foo,dc=bar,dc=com is a constant
        abc@xyz.org is different every entry
        dc: cn=... is always the first line of an entry
        each entry is seperated by a blank line.

        How do I use sed to replace that mail=abc@xyz.org with
        dc=foo,dc=bar,dc=com

        thanks in advance