Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
grep output of command and display all lines that match a string

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: johnd@DOMAIN.COM
Email address: johnd@domain.com
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"?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

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}'
over 4 years ago · Santiago Trujillo Report

0

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

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!