Oy... look at all that unneccessity.... nastay....Ofloo wrote:and why use exec ???
and from what i can say this is os independentCode: Select all
#Usage: [badtext:filter mytextfile.txt badtext] proc badtext:filter {filename badtext} { set rfile [open "$filename" "r"] set wfile [open "tmp/$filename.tmp" "w"] while {![eof $rfile]} { gets $rfile line if {![string match -nocase "*$badtext*" $line]} { puts $wfile $line } } close $rfile close $wfile set rfile [open "tmp/$filename.tmp" "r"] set wfile [open "$filename" "w"] foreach line [split [read $rfile] \n] { puts $wfile $line } close $rfile close $wfile }
Code: Select all
proc badtext:filter {filename badtext} {
set inbuf [split [read [set inf [open $filename r]]][close $inf] \n]
while {[set fpos [lsearch -- $inbuf "*$badtext*"]] != -1} {
set inbuf [lreplace $inbuf $fpos $fpos]
}
puts [set outf [open $filename w]] [join $inbuf \n]
close $outf
}
you got my attention write now ... ???GodOfSuicide wrote:i tried to reach you on irc the last week (remember that austrian #helpdesk guy ? you seamed to be afk the whole time