string |
12/12/2005 |
Exemple tcl montrant commant trouver un mot dans un fichier
#!/usr/bin/tcl
# match demo
set fhandle [open words r]
set yes 0; set no 0
puts -nonewline "Globbing match demo - Pattern: "
flush stdout
set want [gets stdin]
while {[scan [gets $fhandle] %s word] >0} {
if {[string match $want $word]} {
puts "Matched $word"
incr yes
} else {
incr no
}
}
puts "matched $yes, didn't match $no"
gets stdin
fonctions