Basically I'm running an ldapsearch command to grab the AD info for a computer record. I want to then grab the dn: line so I can feed this to ldapdelete to remove the Macs AD entry before trying to reimage it. I want to capture this entire line into a variable - dn:
CN=faimd-a01392,OU=Macintosh,OU=Computers,OU=plantname,OU=Plants,DC=domain,D
C=company,DC=com
but piping it to 'grep dn:' gives me this:
dn: CN=faimd-a01392,OU=Macintosh,OU=Computers,OU=plantname,OU=Plants,DC=domain,D.
How can I get it all on one line?