Re: Handling output from ldapsearch
- From: Helmut Giese <hgiese@xxxxxxxxxxxxx>
- Date: Mon, 30 Jun 2008 16:06:33 +0200
On Mon, 30 Jun 2008 06:38:57 -0700 (PDT), utbloke@xxxxxxxxx wrote:
"dn: CN=user01,CN=Users,DC=mynet,DC=localHi,
sAMAccountName: user01
dn: CN=user02,CN=Users,DC=mynet,DC=local
sAMAccountName: user02
dn: CN=user03,CN=Users,DC=mynet,DC=local
sAMAccountName: user03"
assuming that each result is on a line of its own and that the whole
string is in a variable 's' e.g. by means of a call like
set s [<your call here>]
the following should work:
---
# turn 's' into a list of lines
set lineLst [split $s \n]
# make sure you start with an empty list
set userLst {}
# iterate over the lines
foreach line $lineLst {
if { $line eq "" } {
# ignore empty lines
continue
}
# isolate the words in $line
set wordLst [split $line " "]
# ... and take the last one
lappend userLst [lindex $wordLst end]
}
puts "userLst: $userLst"
---
HTH
Helmut Giese
.
- Follow-Ups:
- Re: Handling output from ldapsearch
- From: Cameron Laird
- Re: Handling output from ldapsearch
- References:
- Handling output from ldapsearch
- From: utbloke
- Handling output from ldapsearch
- Prev by Date: Re: Handling output from ldapsearch
- Next by Date: Re: Limiting resources used by scripts on web server
- Previous by thread: Re: Handling output from ldapsearch
- Next by thread: Re: Handling output from ldapsearch
- Index(es):
Relevant Pages
|