Wednesday, March 16, 2011

version of greb ip script tcl 8.5.9 that doesn't miss 144.x.x.170

#!/usr/local/bin/tclsh
# tcl 8.5.9 used
## Read the file
set handle [open 144a]
set gunk [read $handle]
close $handle
## Split into records on 1 blank space
set words [split $gunk " "]
#pick out ips on 144 tila network
set boxes [lsort -unique [lsearch -all -inline $words {144*[0-9]}]]
#remove ips with .0 on the end, network names
set nozero [lsearch -all -inline -not $boxes {*\.0}]
#open result file
set outpipe [open grabip5results a]
# write ips to result file, one per line
foreach ip $nozero {
puts $outpipe $ip
}

#close result file
close $outpipe

No comments: