伙计们,我需要根据 10k 记录列表在 ldap 上添加一系列条目。我有以下代码:
awk -v uid=999905284 '
{
print "dn: uid="$0",ou=aaa,ou=bbb,dc=br\n
uid: "$0"\n
sn: "$0"\n
cn: "$0"\n
mail: "$0"@grupos.a.br\n
description: "$0"\n
phpgwAccountType: l\n
phpgwAccountStatus: A\n
uidNumber: "uid++"\n
gidNumber: 0\n
deliveryMode: forwardOnly\n
accountStatus: active\n
defaultMemberModeration: 1\n"
}' list
list的输入如下:
list-a
list-b
...
list-n
样本预期输出:
dn: uid=list-a,ou=aaa,ou=bbb,dc=br\n
uid: list-a
sn: list-a
cn: list-a
mail: list-a@grupos.a.br
description: list-a
phpgwAccountType: l
phpgwAccountStatus: A
uidNumber: 999905284
gidNumber: 0
deliveryMode: forwardOnly
accountStatus: active
defaultMemberModeration: 1
dn: uid=list-b,ou=aaa,ou=bbb,dc=br\n
uid: list-b
sn: list-b
cn: list-b
mail: list-b@grupos.a.br
description: list-b
phpgwAccountType: l
phpgwAccountStatus: A
uidNumber: 999905285
gidNumber: 0
deliveryMode: forwardOnly
accountStatus: active
defaultMemberModeration: 1
我希望输出 $0 将替换为列表的名称,但它不起作用。
提前致谢!