Skip to content

Instantly share code, notes, and snippets.

@troyjr
troyjr / parseldap.R
Created July 5, 2014 00:21
R LDAP - parse ldap output from RCurl to dataframe ala Apache Directory studio export to csv.
library(RCurl)
library(gtools)
parseldap<-function(url, userpwd=NULL)
{
ldapraw<-getURL(url, userpwd=userpwd)
# seperate by two new lines
ldapraw<-gsub("(DN: .*?)\n", "\\1\n\n", ldapraw)
ldapsplit<-strsplit(ldapraw, "\n\n")
ldapsplit<-unlist(ldapsplit)