[Gllug] Help with sed

Simon Morris simon.morris at penguinit.com
Fri Apr 11 16:57:17 UTC 2003


Hello GLLUGers,

My fragile knowledge of sed hasn't got me through this problem. Can you help?

I need to alter some LDIF files. The files have a couple of hundred
entries like so....

dn: cn=Bob Smith,ou=contacts,dc=mydomain,dc=org
changetype: add
company: MyCompany

dn: cn=John Jones,ou=contacts,dc=mydomain,dc=org
changetype: add
company: MyCompany

to.....

dn: cn=Bob Smith,ou=contacts,dc=mydomain,dc=org
changetype: modify
replace: company
company: A Different Company

etc...


So the trick is identify all the "changetype: add" lines and replace them
with the last 3 lines in the second example (does that make sense????)

I'm sure you guys will crack this in a second but sed makes my head hurt!

Thanks

-- 
Simon Morris
simon.morris at penguinit.com



-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list