|
To be more efficient, here's what I want to do : I've made a script wich generates automatically disclaimers (or signatures) using an AD database to search users attributes : name, surname, telephone number... I've made a command like this : ldapsearch -LLL -C \ -h 'DC.DOMAIN.LAN' \ -b 'ou=OU_NAME,dc=DOMAIN,dc=lan' \ -D 'CN=binder,OU=OU_NAME,DC=DOMAIN,DC=lan' \ -w 'BINDER_PW' \ '(sAMAccountname='A_USER_NAME')' sn \ | sed -n -e 's/^.*sn: //p' With this command, I catch the "sn" attribute of a user. This command only works if the sn dosen't contain special caracters. If it does, I had to use "sed" like this : sed -n -e 's/^.*sn:: //p' With the "sed" command, I only take what is after the "sn:" or "sn::" to only have data I want. The result of this command is sent in a variable of my script I use after to make html and txt signatures. This scripts works perfectly, only when an attribute I catch have a special caracter. What you said is a good track for me. What I "only have to do" is to search if the line contains one or two ":". If there's one ":", I don't have decode, if there's two":", I have to decode. Are you OK with me ? Thanks a lot. Nicolas Le 26/05/2014 15:08, Matthias Apitz a
écrit :
El día Monday, May 26, 2014 a las 02:08:51PM +0200, Nicolas Cauchie escribió: |