Afficher un message
Vieux 09/06/2008, 20h29   #1
jdevito01@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Trying to add threading to parse a .txt file.

Hi All,

I have code that will parse a text file line by line and then send the
variable I want to a sub routine to send pages to people. My question
is can I use threads to parse that text file with out duplicating the
output. Below is the code it may make more sense to look at it.

#!/usr/bin/ruby

trap('SIGHUP','IGNORE')

i = 0

def autopage(pagenum,count)

begin

`snpp -s SERVER ADDRESS -f 'EOC Notify' -m 'test' #{pagenum}`
rescue
puts "#{pagenum} has NOT been paged."
else
puts "#{pagenum} has been paged. #{count} "
end
end


File.open('//var//lib//asterisk//agi-bin//pager_list.txt', 'r') do |
f1|
while line = f1.gets
result = {}
pagenum,fname,lname=line.split(" ")
if line.split.empty?
else
if pagenum == "####"
else
count = (i += 1)
autopage(pagenum,count)
end
end
end
end


Thanks!!
  Réponse avec citation
 
Page generated in 0,04950 seconds with 9 queries