#join 常用在列表中的元素组成一个字符串.
set a {a b c {de} 
ef g 
ok}
join $a { }
join $a {}


#eval命令的使用    构造命令
set a {puts "hello";}
set b {puts "ok";}
eval $a $b

#source 路径是/ 不是 \


#upvar    
upvar #0 portGroup arrayName
#不管在哪个站都可以引用.

#regexp(    indics,-line)

set a "
10.10.10.0/24 gi/03 label 30
20.20.20.0/24 gi/03 label 40
"
regexp -line {\d+.\d+.\d+.0(.*)?gi/03} $a match 
#匹配到10.10.10.0/24 gi/03
regexp {\d+.\d+.\d+.0(.*)?gi/03} $a match 
#匹配到10.10.10.0/24 gi/03 label 30
#20.20.20.0/24 gi/03

#string
string compare -nocase -length 20 $str1 $str2
string equal $str1 $str2

string first ab defabcab
string first ab {ffefeffe efab e eab}
string last ab defabcab

string index abcdefe 2
string index abcfe end-2

string length {abcdef fef ef }
llength {abcfe fe fe}

string match {*[a-z]} dfeaff

string range {abffe fefe    ef} 0 6
string range {abffe fefe    ef} 0 end

string repeat "abc" 2

string replace {dfe e f ef e} 0 3 hello

string tolower {feeEFe}
string toupper {feeEfe}

#默认去掉所有空白符号等.
string trim $a 
string trimleft $a
string trimright $a

#文件操作 (打开文件,取出,再覆盖.?)
set fileId [open E:/dynamip/tes.tcl w]

set line [gets $fileId]

puts $fileId "okkkk$line"

flush $fileId

close $fileId