title: How can I configure a shell script which will parse ldap data in ldif format for each dn:
body: <p>I have a LDIF database something like this.</p>
  
  <pre><code>dn: uid=user1,ou=People,dc=example,dc=com
  mail: user1@example.com
  passwordexpirationtime: 20120113203000Z
  
  dn: uid=user2,ou=People,dc=example,dc=com
  mail: user2@example.com
  passwordexpirationtime: 20120113203000Z
  
  dn: uid=user3,ou=People,dc=example,dc=com
  mail: user3@example.com
  passwordexpirationtime: 20120113203000Z
  </code></pre>
  
  <p>How can I configure a shell script to parse each dn: check the value of passwordexpirationtime, compare it with current date. if less then 10 days then send a mail to value in mail attribute ? </p>
  
  <p>If I search the value of attribute by <code>grep passwordexpirationtime |awk -F ':' '{print $2}'</code> It will return value for all dn: how will I know which mail: is associated by which dn:</p>