Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

132
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda