|
Revision 1, 405 bytes
(checked in by thesz, 2 years ago)
|
Initial commit
|
- Property svn:executable set to
*
|
| Line | |
|---|
| 1 |
#!/usr/bin/tclsh |
|---|
| 2 |
# |
|---|
| 3 |
# A script to determine clock time where the first token to host sent. |
|---|
| 4 |
|
|---|
| 5 |
if {[llength $argv]==0} { |
|---|
| 6 |
set fn - |
|---|
| 7 |
set h stdin |
|---|
| 8 |
} else { |
|---|
| 9 |
set fn [lindex $argv 0] |
|---|
| 10 |
set h [open $fn] |
|---|
| 11 |
} |
|---|
| 12 |
|
|---|
| 13 |
gets $h _ |
|---|
| 14 |
gets $h s |
|---|
| 15 |
if {![regexp {remains ([0-9]*)} $s _ remains]} { |
|---|
| 16 |
puts stderr "No total detected." |
|---|
| 17 |
exit 1 |
|---|
| 18 |
} |
|---|
| 19 |
|
|---|
| 20 |
close $h |
|---|
| 21 |
|
|---|
| 22 |
set re "remains [expr $remains -1]" |
|---|
| 23 |
|
|---|
| 24 |
set r [exec grep $re $fn | head -n 1 -] |
|---|
| 25 |
puts $r |
|---|