Hi I am very new to Linux and I need to carry out the following tasks:
I have an LDAP search that I have set to query an Open LDAP server and the results I have redirected to a log file called ldaptest.log, this all works fine.
The issue is that there is data in the file that I don't want to use as I wish to import the data into a database, an example is as follows:
---------------------------------------------------------
dn: uid=user1,ou=users,dc=domain,dc=com
mail:
user1@domain.com
dn: uid=user2,ou=users,dc=domain,dc=com
mail:
user2@domain.com
dn: uid=user3,ou=users,dc=domain,dc=com
mail:
user3@domain.com
---------------------------------------------------------
I need to remove all the data relating to the dn: so as to just leave the email addresses, like the following:
mail:
user1@domain.com
mail:
user2@domain.com
mail:
user3@domain.com
Can anyone tell me how I go about this, it needs to be ran as an automated event as the LDAP search will run and produce the file and then after the file has been created I need to run something to change the data in the file prior to the import.
Thanks in advance.