#!/usr/bin/tclsh # The server which creates these files will break the list up into two # approximately equal files. The servers which watch the data in real time # will go to each server which creates the files, and look for a file with # that name. Currently I'm expecting to see "Symbols1.txt" or "Symbols2.txt" # for this argument, but it could be anything. set which_file [lindex $argv 0] # Aside from "Canada" these server names are of only historical interest. # All of the non-canadian data is spread equally amoung the other servers. #set source_servers {Canada NYSE AMEX {NASDAQ 0} {NASDAQ 1} {NASDAQ 2}} set source_servers {Canada {Clone Disease 0} {Clone Disease 1}} foreach server $source_servers { lappend source_files "/net/shauna/home/phil/SharedDocs/Alerts\ Software/$server/$which_file" } foreach file $source_files { set handle [open $file RDONLY] while {![eof $handle]} { gets $handle line if {$line != {}} { lappend symbols $line } } close $handle } set dest_files {../test/1/data/Symbols.txt.incoming ../test/2/data/Symbols.txt.incoming ../test/3/data/Symbols.txt.incoming} foreach dest_file $dest_files { set handle [open $dest_file {WRONLY CREAT TRUNC}] lappend dest_handles $handle lappend vars var_gensym($handle) } foreach $vars $symbols { foreach var $vars handle $dest_handles { set symbol [set $var] if {$symbol != {}} { puts $handle $symbol } } } foreach handle $dest_handles { close $handle } #cp /net/shauna/home/phil/SharedDocs/Alerts\ Software/NASDAQ\ 0/Symbols1.txt ../test/1/data/Symbols.txt #cp /net/shauna/home/phil/SharedDocs/Alerts\ Software/NASDAQ\ 0/Symbols2.txt ../test/2/data/Symbols.txt #cp /net/shauna/home/phil/SharedDocs/Alerts\ Software/NASDAQ\ 0/Symbols3.txt ../test/3/data/Symbols.txt exec mv ../test/1/data/Symbols.txt.incoming ../test/1/data/Symbols.txt exec mv ../test/2/data/Symbols.txt.incoming ../test/2/data/Symbols.txt exec mv ../test/3/data/Symbols.txt.incoming ../test/3/data/Symbols.txt