Skip to content

Instantly share code, notes, and snippets.

@offby1
Forked from anonymous/file1.csv
Created August 14, 2010 23:42
Show Gist options
  • Save offby1/524852 to your computer and use it in GitHub Desktop.
Save offby1/524852 to your computer and use it in GitHub Desktop.
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 8.
"DN","objectClass","homeMDB","name","displayName","mail","givenName","sAMAccountName","mailnickname","msExchHomeServerName","mDBUseDefaults"
"CN=%%k,OU=Users,OU=2013,OU=Secondary,OU=Students,OU=Users,OU=dn1,DC=dn2,DC=dn3,DC=dn4,DC=dn5","%%j","CN=2013","%%k","%%k","%%[email protected]","%%k","%%k","%%[email protected]","CN=InformationStore,CN=server1,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=shortAD,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=dn1,DC=dn2,DC=dn3,DC=dn4","TRUE"
file2
fn1sn1,fn1,sn1
fn1sn2,fn2,sn2
fn1sn3,fn3,sn3
file3
for /f "tokens=1,2,3 delims=, " %%i in (file1.csv) do csvde -i -k -f file2.csv -j .\
(let ((inputs
`(("[email protected]" . "something else")
("[email protected]" . "sam's other thing")
("[email protected]" . "mary's thang"))))
(mapc (lambda (p)
(let ((email (car p))
(other (cdr p)))
(insert (format "\"CN=%s,OU=Users,OU=2013,OU=Secondary,OU=Students,OU=Users,OU=dn1,DC=dn2,DC=dn3,DC=dn4,DC=dn5\",\"%s\",\"CN=2013\",\"%s\",\"%s\",\"%[email protected]\",\"%s\",\"%s\",\"%[email protected]\",\"CN=InformationStore,CN=server1,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=shortAD,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=dn1,DC=dn2,DC=dn3,DC=dn4\",\"TRUE\"\n" email other email email email email email email))))
inputs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment