From: Larry W. Virden on
On May 6, 11:04 am, rfransix <rfran...(a)comcast.net> wrote:
>
> So it fills in the spaces with pound signs, what's up with that?- Hide quoted text -
>
> - Show quoted text -

What version of Tcl are you using, and on what platform?

Here's what I see with Tcl 8.5.4:

$ cat tst.tcl
#! /usr/tcl85/bin/tclsh8.5

set rh_file(abce) ""

set tmp
{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}}

puts "lindex $tmp 1 is [lindex $tmp 1]"

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

puts "Encountered $rh_file(abce), rc = $rc"
$ ./tst.tcl
lindex
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} 1 is
Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp
Encountered CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp, rc = 1

Notice that I got into $tmp differently than your previous code -
perhaps your real life data requires the double lindex, but the same
you provided didn't require going that deep.

Note that I tried my script against Tcl 8.6 and it worked the same
there as well.

I recommend using a small coherent example script to work out the
details of what you are trying to do. This allows you to tweak the
data to make it follow your live data closely without violating
privacy concerns. Once you have the exact data, and a small amount of
Tcl code that demonstrates the issue, including the same script allows
others on the same platform, or alternative platforms, to see if the
problem is common or unique to your site.

From: rfransix on
On May 6, 10:49 am, "Larry W. Virden" <lvir...(a)gmail.com> wrote:
> On May 6, 11:04 am, rfransix <rfran...(a)comcast.net> wrote:
>
>
>
> > So it fills in the spaces with pound signs, what's up with that?- Hide quoted text -
>
> > - Show quoted text -
>
> What version of Tcl are you using, and on what platform?
>
> Here's what I see with Tcl 8.5.4:
>
> $ cat tst.tcl
> #! /usr/tcl85/bin/tclsh8.5
>
> set rh_file(abce) ""
>
> set tmp
> {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}}
>
> puts "lindex $tmp 1 is [lindex $tmp 1]"
>
> set rc [regexp {^Name=(.*)} [lindex $tmp 1] -> rh_file(abce)]
>
> puts "Encountered $rh_file(abce), rc = $rc"
> $ ./tst.tcl
> lindex
> 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} 1 is
> Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp
> Encountered CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp, rc = 1
>
> Notice that I got into $tmp differently than your previous code -
> perhaps your real life data requires the double lindex, but the same
> you provided didn't require going that deep.
>
> Note that I tried my script against Tcl 8.6 and it worked the same
> there as well.
>
> I recommend using a small coherent example script to work out the
> details of what you are trying to do. This allows you to tweak the
> data to make it follow your live data closely without violating
> privacy concerns. Once you have the exact data, and a small amount of
> Tcl code that demonstrates the issue, including the same script allows
> others on the same platform, or alternative platforms, to see if the
> problem is common or unique to your site.

Unfortunately, this Windows Server 2003 is running tcl8.3
From: rfransix on
On May 6, 11:19 am, rfransix <rfran...(a)comcast.net> wrote:
> On May 6, 10:49 am, "Larry W. Virden" <lvir...(a)gmail.com> wrote:
>
>
>
>
>
> > On May 6, 11:04 am, rfransix <rfran...(a)comcast.net> wrote:
>
> > > So it fills in the spaces with pound signs, what's up with that?- Hide quoted text -
>
> > > - Show quoted text -
>
> > What version of Tcl are you using, and on what platform?
>
> > Here's what I see with Tcl 8.5.4:
>
> > $ cat tst.tcl
> > #! /usr/tcl85/bin/tclsh8.5
>
> > set rh_file(abce) ""
>
> > set tmp
> > {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}}
>
> > puts "lindex $tmp 1 is [lindex $tmp 1]"
>
> > set rc [regexp {^Name=(.*)} [lindex $tmp 1] -> rh_file(abce)]
>
> > puts "Encountered $rh_file(abce), rc = $rc"
> > $ ./tst.tcl
> > lindex
> > 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} 1 is
> > Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp
> > Encountered CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp, rc = 1
>
> > Notice that I got into $tmp differently than your previous code -
> > perhaps your real life data requires the double lindex, but the same
> > you provided didn't require going that deep.
>
> > Note that I tried my script against Tcl 8.6 and it worked the same
> > there as well.
>
> > I recommend using a small coherent example script to work out the
> > details of what you are trying to do. This allows you to tweak the
> > data to make it follow your live data closely without violating
> > privacy concerns. Once you have the exact data, and a small amount of
> > Tcl code that demonstrates the issue, including the same script allows
> > others on the same platform, or alternative platforms, to see if the
> > problem is common or unique to your site.
>
> Unfortunately, this Windows Server 2003 is running tcl8.3- Hide quoted text -
>
> - Show quoted text -

When I run the tcl script with set rh_file(abce) "", it returns an
error, or with $rh_file(abdc) ""

wrong # args: should be "set varName ?newValue?"
while compiling
"set $rh_file(manager) to """

From: rfransix on
On May 6, 11:28 am, rfransix <rfran...(a)comcast.net> wrote:
> On May 6, 11:19 am, rfransix <rfran...(a)comcast.net> wrote:
>
>
>
>
>
> > On May 6, 10:49 am, "Larry W. Virden" <lvir...(a)gmail.com> wrote:
>
> > > On May 6, 11:04 am, rfransix <rfran...(a)comcast.net> wrote:
>
> > > > So it fills in the spaces with pound signs, what's up with that?- Hide quoted text -
>
> > > > - Show quoted text -
>
> > > What version of Tcl are you using, and on what platform?
>
> > > Here's what I see with Tcl 8.5.4:
>
> > > $ cat tst.tcl
> > > #! /usr/tcl85/bin/tclsh8.5
>
> > > set rh_file(abce) ""
>
> > > set tmp
> > > {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}}
>
> > > puts "lindex $tmp 1 is [lindex $tmp 1]"
>
> > > set rc [regexp {^Name=(.*)} [lindex $tmp 1] -> rh_file(abce)]
>
> > > puts "Encountered $rh_file(abce), rc = $rc"
> > > $ ./tst.tcl
> > > lindex
> > > 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} 1 is
> > > Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp
> > > Encountered CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp, rc = 1
>
> > > Notice that I got into $tmp differently than your previous code -
> > > perhaps your real life data requires the double lindex, but the same
> > > you provided didn't require going that deep.
>
> > > Note that I tried my script against Tcl 8.6 and it worked the same
> > > there as well.
>
> > > I recommend using a small coherent example script to work out the
> > > details of what you are trying to do. This allows you to tweak the
> > > data to make it follow your live data closely without violating
> > > privacy concerns. Once you have the exact data, and a small amount of
> > > Tcl code that demonstrates the issue, including the same script allows
> > > others on the same platform, or alternative platforms, to see if the
> > > problem is common or unique to your site.
>
> > Unfortunately, this Windows Server 2003 is running tcl8.3- Hide quoted text -
>
> > - Show quoted text -
>
> When I run the tcl script with set rh_file(abce) "", it returns an
> error, or with $rh_file(abdc) ""
>
> wrong # args: should be "set varName ?newValue?"
>     while compiling
> "set $rh_file(manager) to """- Hide quoted text -
>
> - Show quoted text -

my mistake, should be just: set rh_file(abce) ""
and that works as expected, thank you.

the single lindex fails in my script.

The double lindex works great, except for changing the spaces to
pounds. here's what I'm working on, which is not working:

if { [regexp {^Name=(.*)} [lindex [lindex $tmp 0] 1] -> rh_file(abce)]
== 0 } then {
regsub -all "#" $rh_file(abce) " " -> rh_file(abce)
} else {
set rh_file(abce) ""
}
From: Alexandre Ferrieux on
On May 6, 6:48 pm, rfransix <rfran...(a)comcast.net> wrote:
> On May 6, 11:28 am, rfransix <rfran...(a)comcast.net> wrote:
>
>
>
>
>
> > On May 6, 11:19 am, rfransix <rfran...(a)comcast.net> wrote:
>
> > > On May 6, 10:49 am, "Larry W. Virden" <lvir...(a)gmail.com> wrote:
>
> > > > On May 6, 11:04 am, rfransix <rfran...(a)comcast.net> wrote:
>
> > > > > So it fills in the spaces with pound signs, what's up with that?- Hide quoted text -
>
> > > > > - Show quoted text -
>
> > > > What version of Tcl are you using, and on what platform?
>
> > > > Here's what I see with Tcl 8.5.4:
>
> > > > $ cat tst.tcl
> > > > #! /usr/tcl85/bin/tclsh8.5
>
> > > > set rh_file(abce) ""
>
> > > > set tmp
> > > > {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}}
>
> > > > puts "lindex $tmp 1 is [lindex $tmp 1]"
>
> > > > set rc [regexp {^Name=(.*)} [lindex $tmp 1] -> rh_file(abce)]
>
> > > > puts "Encountered $rh_file(abce), rc = $rc"
> > > > $ ./tst.tcl
> > > > lindex
> > > > 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} 1 is
> > > > Name=CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp
> > > > Encountered CN=Buggs\\, Bunny D,OU=Users,OU=Corporate,DC=corp, rc = 1
>
> > > > Notice that I got into $tmp differently than your previous code -
> > > > perhaps your real life data requires the double lindex, but the same
> > > > you provided didn't require going that deep.
>
> > > > Note that I tried my script against Tcl 8.6 and it worked the same
> > > > there as well.
>
> > > > I recommend using a small coherent example script to work out the
> > > > details of what you are trying to do. This allows you to tweak the
> > > > data to make it follow your live data closely without violating
> > > > privacy concerns. Once you have the exact data, and a small amount of
> > > > Tcl code that demonstrates the issue, including the same script allows
> > > > others on the same platform, or alternative platforms, to see if the
> > > > problem is common or unique to your site.
>
> > > Unfortunately, this Windows Server 2003 is running tcl8.3- Hide quoted text -
>
> > > - Show quoted text -
>
> > When I run the tcl script with set rh_file(abce) "", it returns an
> > error, or with $rh_file(abdc) ""
>
> > wrong # args: should be "set varName ?newValue?"
> >     while compiling
> > "set $rh_file(manager) to """- Hide quoted text -
>
> > - Show quoted text -
>
> my mistake, should be just: set rh_file(abce) ""
> and that works as expected, thank you.
>
> the single lindex fails in my script.
>
> The double lindex works great, except for changing the spaces to
> pounds. here's what I'm working on, which is not working:
>
> if { [regexp {^Name=(.*)} [lindex [lindex $tmp 0] 1] -> rh_file(abce)]
> == 0 } then {
>         regsub -all "#" $rh_file(abce) " " -> rh_file(abce)} else {
>
>         set rh_file(abce) ""
>
>
>
> }

You got it reversed; [regexp] returns 0 when there has been no match.

-Alex