I'm praying the monks will see through the windows command logic and see a great script that will properly build a changetype modify ldif file from data in 2 different files.
Here's the code that does not work to build an ldif import file. I have 2 files, line for line they match up. One file has all the DN's, the other file has the employeeNumber of each DN. I can't get the two FOR loops to iterate through 2 files one line at a time to build the correct ldif entry, and then proceed through both files iteratively until the last lines.
@echo on ::Set BATCH Input Directory set batchdir=e:\meta ::Set the input file containing the list set infile=%batchdir%\DDNs3 set infile2=%batchdir%\DDNsUid2 ::If exists, we remove output file rm DDNs3.ldif ::For loop below process each line in the input list. :uid FOR /F "tokens=* delims=" %%i IN (%infile%) do ( echo dn: %%i echo changetype: modify echo replace: employeeNumber call :loop2 ) goto :eof :loop2 FOR /F "tokens=* delims=" %%k IN (%infile2%) do ( echo employeeNumber: %%k echo. call :uid ) :eof
20100528 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips
In reply to building an ldif from 2 files by rfransix
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |