-2

I got a problem to solve. How do i hide the 'dn:' part ?

dn: uid=trebbouh,ou=2017_paris,ou=2017,ou=paris,ou=people,dc=42,dc=fr

This is the command I used : ldapsearch -x -LLL uid=$USER -W

Muska
  • 1
  • 1

1 Answers1

0

You can specify which attributes you want to have displayed as the results of a query at the end of your query. For instance if you just want the "mail" and "uid" attributes your command would be

ldapsearch -x -LLL uid=$USER -W mail uid

Alternatively you could just pipe the results through "grep -v dn:"

TheFiddlerWins
  • 2,973
  • 1
  • 14
  • 22
  • That's not what I meant :p – Muska Aug 28 '17 at 14:29
  • I just wanna hide the "dn:" part, and it seems like I just can't find a solution huh.. – Muska Aug 28 '17 at 14:29
  • Write a small wrapper for the ldapsearch command that would use your text manipulator or choice, say, "cut", to alter stdout? Use an alias even? alias ldsuid="ldapsearch ...uid=$USER | cut -d2 -f:" – cachonfinga Sep 13 '17 at 16:43