From: Alexandre Ferrieux on
On May 5, 11:42 pm, rfransix <rfran...(a)comcast.net> wrote:
> 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) ""
>  }


Either set rh_file(abcde) to "" *before* the call to regexp, or check
the returned value. It is 0 in case of no match.

And by all means look at the regexp manpage !!!

-Alex


From: Andreas Leitgeb on
Alexandre Ferrieux <alexandre.ferrieux(a)gmail.com> wrote:
> And by all means look at the regexp manpage !!!

Principially correct advice, but from reading over this
thread, I gather that this manpage just simply beats his
english skills.

From: Donal K. Fellows on
On 6 May, 08:18, Andreas Leitgeb <a...(a)gamma.logic.tuwien.ac.at>
wrote:
> Alexandre Ferrieux <alexandre.ferri...(a)gmail.com> wrote:
> > And by all means look at the regexp manpage !!!
>
> Principially correct advice, but from reading over this
> thread, I gather that this manpage just simply beats his
> english skills.

I'm always interested in how to improve the regexp and re_syntax
manual pages. Suggestions on a postcard please (or email or, best of
all, in a Bug report).

Donal.
From: Andreas Leitgeb on
Donal K. Fellows <donal.k.fellows(a)manchester.ac.uk> wrote:
> On 6 May, 08:18, Andreas Leitgeb <a...(a)gamma.logic.tuwien.ac.at>
>> Alexandre Ferrieux <alexandre.ferri...(a)gmail.com> wrote:
>> > And by all means look at the regexp manpage !!!
>> Principially correct advice, but from reading over this
>> thread, I gather that this manpage just simply beats his
>> english skills.
> I'm always interested in how to improve the regexp and re_syntax
> manual pages. Suggestions on a postcard please (or email or, best of
> all, in a Bug report).

I didn't mean to criticize the manpages. Imagine they were written
in Greek language, and someone told you to read it. You'd probably
try babelfish on it, whose result would be as "understandable" as
for the OP to read the original...

Improvement suggestion (fits on a postcard): travel backwards in
time, and prevent the tower of babylon from being even attempted ;-D

From: rfransix on
On May 6, 9:23 am, Andreas Leitgeb <a...(a)gamma.logic.tuwien.ac.at>
wrote:
> Donal K. Fellows <donal.k.fell...(a)manchester.ac.uk> wrote:
>
> > On 6 May, 08:18, Andreas Leitgeb <a...(a)gamma.logic.tuwien.ac.at>
> >> Alexandre Ferrieux <alexandre.ferri...(a)gmail.com> wrote:
> >> > And by all means look at the regexp manpage !!!
> >> Principially correct advice, but from reading over this
> >> thread, I gather that this manpage just simply beats his
> >> english skills.
> > I'm always interested in how to improve the regexp and re_syntax
> > manual pages. Suggestions on a postcard please (or email or, best of
> > all, in a Bug report).
>
> I didn't mean to criticize the manpages.  Imagine they were written
> in Greek language, and someone told you to read it.  You'd probably
> try babelfish on it, whose result would be as "understandable" as
> for the OP to read the original...
>
> Improvement suggestion (fits on a postcard): travel backwards in
> time, and prevent the tower of babylon from being even attempted ;-D

Thanks for all your advice.

There is one issue, actually two, with the regexp, from $tmp, we have

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}}

and regexp {^Name=(.*)} [lindex [lindex $tmp 0] 1] -> rh_file(abce)
returns this:
Name=CN=Buggs\\,#Bunny#D.,OU=Users,OU=Corporate,DC=corp
instead of this:
Name=CN=Buggs\\, Bunny D.,OU=Users,OU=Corporate,DC=corp

So it fills in the spaces with pound signs, what's up with that?