From: Alexandre Ferrieux on
On May 5, 10:52 pm, rfransix <rfran...(a)comcast.net> wrote:
> On May 5, 3:45 pm, Alexandre Ferrieux <alexandre.ferri...(a)gmail.com>
> wrote:
>
>
>
>
>
> > On May 5, 10:42 pm, rfransix <rfran...(a)comcast.net> wrote:
>
> > > On May 5, 3:27 pm, Alexandre Ferrieux <alexandre.ferri...(a)gmail.com>
> > > wrote:
>
> > > > On May 5, 10:19 pm, rfransix <rfran...(a)comcast.net> wrote:
>
> > > > > After a set cmd search command, we end up with $tmp like this (two
> > > > > ldap attributes with their values after the equal signs):
>
> > > > > {uid=001110001,ou=People,ou=abc,ou=abcd,o=abcde,cn=Users,cn=abcdef
> > > > > {Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp}}
>
> > > > > The two attributes are seperated with a space.
>
> > > > > The string command I'm using doesn't work, any ideas what I'm doing
> > > > > wrong, or a more expert method is welcome. Thank you.
>
> > > > > set rh_file(abce) [string range $tmp [expr "[string first Name $tmp]]
> > > > > +100"]
>
> > > > > I want rh_file(abce) to contain CN=Buggs\\, Bunny
> > > > > D,OU=Users,OU=Corporate,DC=corp
>
> > > > regexp {^Name=(.*)} [lindex $tmp 1] -> rh_file(abce)
>
> > > > -Alex- Hide quoted text -
>
> > > > - Show quoted text -
>
> > > Thanks Alex,
>
> > > That may work. I tried to turn around the command, cause I don't how
> > > to rep ->, when I type:
>
> > > set rh_file(abce) "regexp {^exName=(.*)} [lindex $tmp 1]"
>
> > > it returns
>
> > > abce:regexp#^exDistinguishedName=(.*)
>
> > Sorry, I cannot parse your question.
>
> > -Alex- Hide quoted text -
>
> > - Show quoted text -
>
> okay, you provided> > > regexp {^Name=(.*)} [lindex $tmp 1] -> rh_file(abce)
>
> I can't type that in and get it to work because I don't know what "->"
> represents. Is that a valid a tcl command? Not sure. So I tried to
> reverse the command and set rh_file(abce) to your regexp command, but
> that doesn't work either. Any ideas?

Try typing exactly the line I provided. "->" is a common idiom meaning
a placeholder for a variable that you don't care about. See regexp
manpage.

-Alex
From: rfransix on
On May 5, 3:55 pm, Alexandre Ferrieux <alexandre.ferri...(a)gmail.com>
wrote:
> On May 5, 10:52 pm, rfransix <rfran...(a)comcast.net> wrote:
>
>
>
>
>
> > On May 5, 3:45 pm, Alexandre Ferrieux <alexandre.ferri...(a)gmail.com>
> > wrote:
>
> > > On May 5, 10:42 pm, rfransix <rfran...(a)comcast.net> wrote:
>
> > > > On May 5, 3:27 pm, Alexandre Ferrieux <alexandre.ferri...(a)gmail.com>
> > > > wrote:
>
> > > > > On May 5, 10:19 pm, rfransix <rfran...(a)comcast.net> wrote:
>
> > > > > > After a set cmd search command, we end up with $tmp like this (two
> > > > > > ldap attributes with their values after the equal signs):
>
> > > > > > {uid=001110001,ou=People,ou=abc,ou=abcd,o=abcde,cn=Users,cn=abcdef
> > > > > > {Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp}}
>
> > > > > > The two attributes are seperated with a space.
>
> > > > > > The string command I'm using doesn't work, any ideas what I'm doing
> > > > > > wrong, or a more expert method is welcome. Thank you.
>
> > > > > > set rh_file(abce) [string range $tmp [expr "[string first Name $tmp]]
> > > > > > +100"]
>
> > > > > > I want rh_file(abce) to contain CN=Buggs\\, Bunny
> > > > > > D,OU=Users,OU=Corporate,DC=corp
>
> > > > > regexp {^Name=(.*)} [lindex $tmp 1] -> rh_file(abce)
>
> > > > > -Alex- Hide quoted text -
>
> > > > > - Show quoted text -
>
> > > > Thanks Alex,
>
> > > > That may work. I tried to turn around the command, cause I don't how
> > > > to rep ->, when I type:
>
> > > > set rh_file(abce) "regexp {^exName=(.*)} [lindex $tmp 1]"
>
> > > > it returns
>
> > > > abce:regexp#^exDistinguishedName=(.*)
>
> > > Sorry, I cannot parse your question.
>
> > > -Alex- Hide quoted text -
>
> > > - Show quoted text -
>
> > okay, you provided> > > regexp {^Name=(.*)} [lindex $tmp 1] -> rh_file(abce)
>
> > I can't type that in and get it to work because I don't know what "->"
> > represents. Is that a valid a tcl command? Not sure. So I tried to
> > reverse the command and set rh_file(abce) to your regexp command, but
> > that doesn't work either. Any ideas?
>
> Try typing exactly the line I provided. "->" is a common idiom meaning
> a placeholder for a variable that you don't care about. See regexp
> manpage.
>
> -Alex- Hide quoted text -
>
> - Show quoted text -

Tried that, it fails to set rh_file(abce) to anything, as a result
$tmp is not parsed at all.


I tried, set rh_file(abce) {regexp {^Name=(.*)} [lindex $tmp 1]}
and it set rh_file(abce):regexp#^Name=(.*)#[lindex#$tmp#1]

I tried "set rh_file(abce) [regexp {^Name=(.*)} [lindex $tmp 1]]
and it set rh_file(abce):0

If we can write the regexp as a result to rh_file(abce), it should
work.
From: Alexandre Ferrieux on
On May 5, 11:08 pm, rfransix <rfran...(a)comcast.net> wrote:
> On May 5, 3:55 pm, Alexandre Ferrieux <alexandre.ferri...(a)gmail.com>
> wrote:
>
>
>
>
>
> > On May 5, 10:52 pm, rfransix <rfran...(a)comcast.net> wrote:
>
> > > On May 5, 3:45 pm, Alexandre Ferrieux <alexandre.ferri...(a)gmail.com>
> > > wrote:
>
> > > > On May 5, 10:42 pm, rfransix <rfran...(a)comcast.net> wrote:
>
> > > > > On May 5, 3:27 pm, Alexandre Ferrieux <alexandre.ferri...(a)gmail..com>
> > > > > wrote:
>
> > > > > > On May 5, 10:19 pm, rfransix <rfran...(a)comcast.net> wrote:
>
> > > > > > > After a set cmd search command, we end up with $tmp like this (two
> > > > > > > ldap attributes with their values after the equal signs):
>
> > > > > > > {uid=001110001,ou=People,ou=abc,ou=abcd,o=abcde,cn=Users,cn=abcdef
> > > > > > > {Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp}}
>
> > > > > > > The two attributes are seperated with a space.
>
> > > > > > > The string command I'm using doesn't work, any ideas what I'm doing
> > > > > > > wrong, or a more expert method is welcome. Thank you.
>
> > > > > > > set rh_file(abce) [string range $tmp [expr "[string first Name $tmp]]
> > > > > > > +100"]
>
> > > > > > > I want rh_file(abce) to contain CN=Buggs\\, Bunny
> > > > > > > D,OU=Users,OU=Corporate,DC=corp
>
> > > > > > regexp {^Name=(.*)} [lindex $tmp 1] -> rh_file(abce)
>
> > > > > > -Alex- Hide quoted text -
>
> > > > > > - Show quoted text -
>
> > > > > Thanks Alex,
>
> > > > > That may work. I tried to turn around the command, cause I don't how
> > > > > to rep ->, when I type:
>
> > > > > set rh_file(abce) "regexp {^exName=(.*)} [lindex $tmp 1]"
>
> > > > > it returns
>
> > > > > abce:regexp#^exDistinguishedName=(.*)
>
> > > > Sorry, I cannot parse your question.
>
> > > > -Alex- Hide quoted text -
>
> > > > - Show quoted text -
>
> > > okay, you provided> > > regexp {^Name=(.*)} [lindex $tmp 1] -> rh_file(abce)
>
> > > I can't type that in and get it to work because I don't know what "->"
> > > represents. Is that a valid a tcl command? Not sure. So I tried to
> > > reverse the command and set rh_file(abce) to your regexp command, but
> > > that doesn't work either. Any ideas?
>
> > Try typing exactly the line I provided. "->" is a common idiom meaning
> > a placeholder for a variable that you don't care about. See regexp
> > manpage.
>
> > -Alex- Hide quoted text -
>
> > - Show quoted text -
>
> Tried that, it fails to set rh_file(abce) to anything, as a result
> $tmp is not parsed at all.

Ah, I assumed the outer braces in your above $tmp value were
introduced by hand. Maybe they are literal.
In this case, type:

regexp {^Name=(.*)} [lindex [lindex $tmp 0] 1] -> rh_file(abce)

-Alex


From: rfransix on
On May 5, 4:16 pm, Alexandre Ferrieux <alexandre.ferri...(a)gmail.com>
wrote:
> On May 5, 11:08 pm, rfransix <rfran...(a)comcast.net> wrote:
>
>
>
>
>
> > On May 5, 3:55 pm, Alexandre Ferrieux <alexandre.ferri...(a)gmail.com>
> > wrote:
>
> > > On May 5, 10:52 pm, rfransix <rfran...(a)comcast.net> wrote:
>
> > > > On May 5, 3:45 pm, Alexandre Ferrieux <alexandre.ferri...(a)gmail.com>
> > > > wrote:
>
> > > > > On May 5, 10:42 pm, rfransix <rfran...(a)comcast.net> wrote:
>
> > > > > > On May 5, 3:27 pm, Alexandre Ferrieux <alexandre.ferri...(a)gmail.com>
> > > > > > wrote:
>
> > > > > > > On May 5, 10:19 pm, rfransix <rfran...(a)comcast.net> wrote:
>
> > > > > > > > After a set cmd search command, we end up with $tmp like this (two
> > > > > > > > ldap attributes with their values after the equal signs):
>
> > > > > > > > {uid=001110001,ou=People,ou=abc,ou=abcd,o=abcde,cn=Users,cn=abcdef
> > > > > > > > {Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp}}
>
> > > > > > > > The two attributes are seperated with a space.
>
> > > > > > > > The string command I'm using doesn't work, any ideas what I'm doing
> > > > > > > > wrong, or a more expert method is welcome. Thank you.
>
> > > > > > > > set rh_file(abce) [string range $tmp [expr "[string first Name $tmp]]
> > > > > > > > +100"]
>
> > > > > > > > I want rh_file(abce) to contain CN=Buggs\\, Bunny
> > > > > > > > D,OU=Users,OU=Corporate,DC=corp
>
> > > > > > > regexp {^Name=(.*)} [lindex $tmp 1] -> rh_file(abce)
>
> > > > > > > -Alex- Hide quoted text -
>
> > > > > > > - Show quoted text -
>
> > > > > > Thanks Alex,
>
> > > > > > That may work. I tried to turn around the command, cause I don't how
> > > > > > to rep ->, when I type:
>
> > > > > > set rh_file(abce) "regexp {^exName=(.*)} [lindex $tmp 1]"
>
> > > > > > it returns
>
> > > > > > abce:regexp#^exDistinguishedName=(.*)
>
> > > > > Sorry, I cannot parse your question.
>
> > > > > -Alex- Hide quoted text -
>
> > > > > - Show quoted text -
>
> > > > okay, you provided> > > regexp {^Name=(.*)} [lindex $tmp 1] -> rh_file(abce)
>
> > > > I can't type that in and get it to work because I don't know what "->"
> > > > represents. Is that a valid a tcl command? Not sure. So I tried to
> > > > reverse the command and set rh_file(abce) to your regexp command, but
> > > > that doesn't work either. Any ideas?
>
> > > Try typing exactly the line I provided. "->" is a common idiom meaning
> > > a placeholder for a variable that you don't care about. See regexp
> > > manpage.
>
> > > -Alex- Hide quoted text -
>
> > > - Show quoted text -
>
> > Tried that, it fails to set rh_file(abce) to anything, as a result
> > $tmp is not parsed at all.
>
> Ah, I assumed the outer braces in your above $tmp value were
> introduced by hand. Maybe they are literal.
> In this case, type:
>
>      regexp {^Name=(.*)} [lindex [lindex $tmp 0] 1] -> rh_file(abce)
>
> -Alex- Hide quoted text -
>
> - Show quoted text -

You are AWESOME. That worked. Those one-liners have it over the ball
of string I was trying to put together.

Many thanks. Richard
From: rfransix on
On May 5, 4:25 pm, rfransix <rfran...(a)comcast.net> wrote:
> On May 5, 4:16 pm, Alexandre Ferrieux <alexandre.ferri...(a)gmail.com>
> wrote:
>
>
>
>
>
> > On May 5, 11:08 pm, rfransix <rfran...(a)comcast.net> wrote:
>
> > > On May 5, 3:55 pm, Alexandre Ferrieux <alexandre.ferri...(a)gmail.com>
> > > wrote:
>
> > > > On May 5, 10:52 pm, rfransix <rfran...(a)comcast.net> wrote:
>
> > > > > On May 5, 3:45 pm, Alexandre Ferrieux <alexandre.ferri...(a)gmail..com>
> > > > > wrote:
>
> > > > > > On May 5, 10:42 pm, rfransix <rfran...(a)comcast.net> wrote:
>
> > > > > > > On May 5, 3:27 pm, Alexandre Ferrieux <alexandre.ferri...(a)gmail.com>
> > > > > > > wrote:
>
> > > > > > > > On May 5, 10:19 pm, rfransix <rfran...(a)comcast.net> wrote:
>
> > > > > > > > > After a set cmd search command, we end up with $tmp like this (two
> > > > > > > > > ldap attributes with their values after the equal signs):
>
> > > > > > > > > {uid=001110001,ou=People,ou=abc,ou=abcd,o=abcde,cn=Users,cn=abcdef
> > > > > > > > > {Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp}}
>
> > > > > > > > > The two attributes are seperated with a space.
>
> > > > > > > > > The string command I'm using doesn't work, any ideas what I'm doing
> > > > > > > > > wrong, or a more expert method is welcome. Thank you.
>
> > > > > > > > > set rh_file(abce) [string range $tmp [expr "[string first Name $tmp]]
> > > > > > > > > +100"]
>
> > > > > > > > > I want rh_file(abce) to contain CN=Buggs\\, Bunny
> > > > > > > > > D,OU=Users,OU=Corporate,DC=corp
>
> > > > > > > > regexp {^Name=(.*)} [lindex $tmp 1] -> rh_file(abce)
>
> > > > > > > > -Alex- Hide quoted text -
>
> > > > > > > > - Show quoted text -
>
> > > > > > > Thanks Alex,
>
> > > > > > > That may work. I tried to turn around the command, cause I don't how
> > > > > > > to rep ->, when I type:
>
> > > > > > > set rh_file(abce) "regexp {^exName=(.*)} [lindex $tmp 1]"
>
> > > > > > > it returns
>
> > > > > > > abce:regexp#^exDistinguishedName=(.*)
>
> > > > > > Sorry, I cannot parse your question.
>
> > > > > > -Alex- Hide quoted text -
>
> > > > > > - Show quoted text -
>
> > > > > okay, you provided> > > regexp {^Name=(.*)} [lindex $tmp 1] -> rh_file(abce)
>
> > > > > I can't type that in and get it to work because I don't know what "->"
> > > > > represents. Is that a valid a tcl command? Not sure. So I tried to
> > > > > reverse the command and set rh_file(abce) to your regexp command, but
> > > > > that doesn't work either. Any ideas?
>
> > > > Try typing exactly the line I provided. "->" is a common idiom meaning
> > > > a placeholder for a variable that you don't care about. See regexp
> > > > manpage.
>
> > > > -Alex- Hide quoted text -
>
> > > > - Show quoted text -
>
> > > Tried that, it fails to set rh_file(abce) to anything, as a result
> > > $tmp is not parsed at all.
>
> > Ah, I assumed the outer braces in your above $tmp value were
> > introduced by hand. Maybe they are literal.
> > In this case, type:
>
> >      regexp {^Name=(.*)} [lindex [lindex $tmp 0] 1] -> rh_file(abce)
>
> > -Alex- Hide quoted text -
>
> > - Show quoted text -
>
> You are AWESOME. That worked. Those one-liners have it over the ball
> of string I was trying to put together.
>
> Many thanks. Richard- Hide quoted text -
>
> - Show quoted text -

While the regexp worked, I need to set rh_file(abce) to "" if there is
no Name returned. I've written this, but it does not work, any help???

if {$tmp != -1} {
regexp {^Name=(.*)} [lindex [lindex $tmp 0] 1] ->
rh_file(abce)
} else {
set rh_file(abce) ""
}