this time, I am learning about lsort.
test.txt file
10:00
12:00
15:00
20:00
02:00
this is a code for sort. but it does not work.
would you please tell me what the problem is?
thank you in advance.
set sortA [lsort -decreasing "$startTime"]
puts $sortA
===== here is a code========
set readFile [open "test.txt" "r"]
gets $readFile line
while {![eof $readFile]} {
set lineList [split $line ,]
set lineList1 [string map {\" ""} $line]
set lineLen [llength $lineList1]
set lenStartTime [expr {$lineList1 - 1}]
set lenRunTime [expr {$lineList1 - 3}]
set houseNum [lindex $lineList1 2]
set startTime [lindex $lineList1 $lenStartTime]
set runTime [lindex $lineList1 $lenRunTime]
set sortA [lsort -decreasing "$startTime"]
puts $sortA
#puts "$houseNum $startTime $runTime"
gets $readFile line
}
test.txt file
10:00
12:00
15:00
20:00
02:00
this is a code for sort. but it does not work.
would you please tell me what the problem is?
thank you in advance.
set sortA [lsort -decreasing "$startTime"]
puts $sortA
===== here is a code========
set readFile [open "test.txt" "r"]
gets $readFile line
while {![eof $readFile]} {
set lineList [split $line ,]
set lineList1 [string map {\" ""} $line]
set lineLen [llength $lineList1]
set lenStartTime [expr {$lineList1 - 1}]
set lenRunTime [expr {$lineList1 - 3}]
set houseNum [lindex $lineList1 2]
set startTime [lindex $lineList1 $lenStartTime]
set runTime [lindex $lineList1 $lenRunTime]
set sortA [lsort -decreasing "$startTime"]
puts $sortA
#puts "$houseNum $startTime $runTime"
gets $readFile line
}