Parse and pull certain attributes and their values from the LDIF file, remove some characters and words, and add delimiters (CSV).
Skill and language preference is up to the freelancer but would prefer Perl or Python.
LDIF Example file, attribute names/values, and intended CSV will be provided (see attached)
Looking to improve on a simple and dirty bash/perl script.
Current Example (only includes two attributes)
cat $ldif | egrep -i '^dn: |^mgrpRFC822MailMember: |^$' | perl -pi -e 's/^$/~~/g' | perl -pi -e 's/,/ /g' | perl -pi -e 's/\n/,/g' | perl -pi -e 's/~~/\n/g' | perl -pi -e 's/^,|,
$//g' > $outfile-temp
cat $outfile-temp | sed -e 's/"[^"]*"//g' | sed -e 's/[<>]//g' > $outfile
Parse LDIF and pull values from only DNs which have an "objectClass" of "nsManagedMailList", ignore all others.
Attributes to CSV - columns separated by "," and attribute values in rows separated by ";"
Parse "cn" add to column A "List"
Parse "mail" add to column B "Mail"
Parse "mailEquivalentAddress", if present add to column C "mailEquivalentAddress" (if not present add no value to column)
Parse "mgmanMemberVisibility", if value is "STEALTH" or "HIDMEM" add "STEALTH" to column D "Visibility" (all other values add "FULLVIS" to column)
Parse "mgrpAllowedDomain", if present add "TRUE" to column E "Internal" (if not present add "FALSE" to column)
Parse "mgrpRFC822MailMember", for each value add to column F "Members" (semi-colon delimited for each) - remove any characters between "" and the symbols "<" and ">" and spaces (intended to only capture SMTP address, see example)
Parse "uniqueMember", for each value add to column G "Owners" (semi-colon delimited for each) - remove "uid=" and ",ou=people,o=[login to view URL],dc=com" from attribute value before adding to CSV
7 freelancers are bidding on average $169 for this job
Dear client. I checked the ldif file and the csv file carefully. No problem. I can make a perfect python script to perform your job. Please ping me to discuss more. Regards.
Nice to meet you. "High quality in time!!!". I want to work with you long term sincerely. I can start your project immediately. I am expert in python . thank you in advance.