This can't be done with just ldapmodify, but you can string a couple things together to do what you're asking. The following runs ldapmodify against an ldif file that we build on the fly from an ldapsearch plus the desired modifications.
ldapmodify -f <(ldapsearch -LLL -b ou=People,dc=example,dc=com -s one uid=* dn | sed 's/^$/add: customerNumber\ncustomerNumber: 12345\n-\nadd: accountNumber\naccountNumber: 12345\n-\n/' )
Note: This is gives all matched entries the same customerNumber and accountNumber. If that's not what you want you'll have to use something more complicated than sed
, perhaps awk
or perl
. Also, it's probably complicated enough that you'll want to do it in more than one line first. Make the ldif, review, then run ldapmodify.