Reputation: 365
I'm trying to display all disabled accounts from the command:
ipa user-find --all
The basic output of the command shows something like this:
dn: uid=johnd,cn=users,cn=accounts,dc=mydomain,dc=com
User login: johnd
First Name: John
Last Name: Doe
Full Name: John Doe
Home directory: /home/johnd
GECOS field: John Doe
Login shell: /bin/bash
Kerberos principal: [email protected]
Email address: [email protected]
UID: 501
GID: 1022
Account disabled: True
Password: True
Member of groups: ipausers
Kerberos keys available: False
ipauniqueid: 75732ha-482x82l-13xa-d820-0120xbba142
objectclass: ipaobject, krbticketpolicyaux, etc.
If I run:
ipa user-find --all | grep "Account disabled: True"
I will get:
Account disabled: True
Account disabled: True
Account disabled: True
Account disabled: True
For all disabled accounts. Is there a way I can have it display all the fields that match "Account disabled: True"
?
Upvotes: 1
Views: 2046
Reputation: 15229
And an awk solution that doesn't depend on order and/or presence of all attributes [and given my knowledge of ldif I'll safely assume that DN: is always on the first line]:
awk 'BEGIN{RS="\n\n";FS="\n"}/Account disabled: True/{print $1}'
Upvotes: 2
Reputation: 721
ipa-user-find --all | grep "Account disabled: True" -B12 -A5
-B
is how many lines before and -A
is how many after. There's probably a more elegant solution, but this works for now.
If you want just the Full Name of each disabled account, just pipe your results to another grep command
Upvotes: 1