yes Tami, the square brackets are used to variable substitution, similar to = sign.
2011/5/17 Tami Nesher <vessely...@gmail.com> > OK I found the problem. I should write: *puts* * [lindex $tcpFallowUDP 0]* > > Thank you. > > > > 2011/5/17 Tami Nesher <vessely...@gmail.com> > >> I change the line* puts $tcpFallowUDP* to *puts* * lindex $tcpFallowUDP 0 >> *in order to print the first argument in the list >> and I got this error:* >> * >> ~/ns-allinone-2.34/ns-2.34/v1/input$ ns input02.tcl >> bad argument "0": should be "nonewline" >> while executing >> "puts lindex $tcpFallowUDP 0" >> (file "input02.tcl" line 6) >> >> Why? >> >> >> >> On Mon, May 16, 2011 at 12:01 AM, мαłłi <malli....@gmail.com> wrote: >> >>> Nesher, >>> >>> It's already stored in a list "tcpFallowUDP", please go through list >>> command you understand very well. >>> you want access first element lets* lindex $tcpFallowUDP 0 ...... lindex >>> $tcpFallowUDP nth* element. >>> >>> >>> >>> On 15 May 2011 13:16, Tami Nesher <vessely...@gmail.com> wrote: >>> >>>> >>>> Hi, thanks ! it works. >>>> I just want to know how to save the numbers in *two *variables, >>>> instead of printing them. can you tell me how? >>>> >>>> 2011/5/9 мαłłi <malli....@gmail.com> >>>> >>>>> Nesher, >>>>> >>>>> here the code, please let me know if i did any mistake >>>>> >>>>> set fid [open input.txt r] >>>>> while {[gets $fid lineInfo] != -1} { >>>>> regexp {.+: (\d+)} $lineInfo match one >>>>> set tcpFallowUDP [lappend tcpFallowUDP $one] >>>>> } >>>>> puts $tcpFallowUDP >>>>> >>>>> >>>>> On 8 May 2011 14:32, Tami Nesher <vessely...@gmail.com> wrote: >>>>> >>>>>> >>>>>> >>>>>> here I attached the file. I need to read the numbers in tcl. >>>>>> >>>>>> On Sun, May 8, 2011 at 1:47 AM, ÞÕÇÏ Úíäì Ýì ßá ãßÇä mohammed < >>>>>> teto...@yahoo.com> wrote: >>>>>> >>>>>> > send the file to show and try to help you >>>>>> > >>>>>> > --- On *Sun, 5/8/11, Tami Nesher <vessely...@gmail.com>* wrote: >>>>>> > >>>>>> > >>>>>> > From: Tami Nesher <vessely...@gmail.com> >>>>>> > Subject: [ns] tcl: read parameters form file >>>>>> > To: ns-users@ISI.EDU >>>>>> > Date: Sunday, May 8, 2011, 4:19 AM >>>>>> > >>>>>> > >>>>>> > >>>>>> > Hi, >>>>>> > I need to read two parameters from file and save them as two >>>>>> variables in >>>>>> > tcl script. >>>>>> > the file needs look like this (for example): >>>>>> > _____: 10 >>>>>> > _____: 20 >>>>>> > each line is one word, and I need to save the numbers. >>>>>> > How can I do this? >>>>>> > Thanks a lot if you have an answer. >>>>>> > >>>>>> > >>>>>> >>>>>> >>>>>> -- >>>>>> רבי משה בן מכיר זצ"ל, מגדולי הראשונים כתב: >>>>>> מי שאומר את ברכת "אשר יצר" בכוונה, ומוציא כל מילה מפיו בקול רם וברור, >>>>>> לא >>>>>> יבוא עליו שום חולי שבעולם, ולא יזדקק כלל לרופאים או לתרופות! >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> >>>>> Thanks, >>>>> >>>>> The box said "Requires Windows 95, NT, or better", so I installed >>>>> Linux. >>>>> >>>>> Mallikarjun [:)] >>>>> >>>>> [image: YouTube] <http://in.youtube.com/mallikv> [image: >>>>> Blogger]<http://basicnetworktipsntricks.blogspot.com/> [image: >>>>> LinkedIn] <http://www.linkedin.com/in/mallikarjunaraok> >>>>> >>>> >>>> >>>> >>>> -- >>>> רבי משה בן מכיר זצ"ל, מגדולי הראשונים כתב: >>>> מי שאומר את ברכת "אשר יצר" בכוונה, ומוציא כל מילה מפיו בקול רם וברור, >>>> לא יבוא עליו שום חולי שבעולם, ולא יזדקק כלל לרופאים או לתרופות! >>>> >>>> >>>> >>>> >>>> >>> >>> >>> -- >>> >>> Thanks, >>> >>> The box said "Requires Windows 95, NT, or better", so I installed Linux. >>> >>> Mallikarjun [:)] >>> >>> [image: YouTube] <http://in.youtube.com/mallikv> [image: >>> Blogger]<http://basicnetworktipsntricks.blogspot.com/> [image: >>> LinkedIn] <http://www.linkedin.com/in/mallikarjunaraok> >>> >> >> >> >> -- >> רבי משה בן מכיר זצ"ל, מגדולי הראשונים כתב: >> מי שאומר את ברכת "אשר יצר" בכוונה, ומוציא כל מילה מפיו בקול רם וברור, לא >> יבוא עליו שום חולי שבעולם, ולא יזדקק כלל לרופאים או לתרופות! >> >> >> >> >> > > > -- > רבי משה בן מכיר זצ"ל, מגדולי הראשונים כתב: > מי שאומר את ברכת "אשר יצר" בכוונה, ומוציא כל מילה מפיו בקול רם וברור, לא > יבוא עליו שום חולי שבעולם, ולא יזדקק כלל לרופאים או לתרופות! > > > > > -- Thanks, The box said "Requires Windows 95, NT, or better", so I installed Linux. Mallikarjun [:)] [image: YouTube] <http://in.youtube.com/mallikv> [image: Blogger]<http://basicnetworktipsntricks.blogspot.com/> [image: LinkedIn] <http://www.linkedin.com/in/mallikarjunaraok>