R
Raju Alluri
Hi, I have a script as below. Can you please tell me if something is
wrong here ?
It errors out for this code where as if I pass full name instead of
variable, it is working.
cat readfile5.rb
#!/usr/bin/env ruby
logfiledir = "/apollo/env/A9AdamAdProxy/var/output/logs"
filename = `ls -t #{logfiledir} | grep service_log | head -1`
fullfilename = logfiledir + "/" + filename
puts "Full name of the file is #{fullfilename}"
file = File.new("#{fullfilename}", "r")
data = ''
while (line = file.gets)
data += line if line =~ /START/ .. line =~ /EOE/
end
file.close
ERROR:
readfile5.rb:6:in `initialize': No such file or directory -
/apollo/env/A9AdamAdProxy/var/output/logs/service_log.2008-11-21-20
(Errno::ENOENT)
from readfile5.rb:6:in `new'
from readfile5.rb:6
Thanks,
Raju
wrong here ?
It errors out for this code where as if I pass full name instead of
variable, it is working.
cat readfile5.rb
#!/usr/bin/env ruby
logfiledir = "/apollo/env/A9AdamAdProxy/var/output/logs"
filename = `ls -t #{logfiledir} | grep service_log | head -1`
fullfilename = logfiledir + "/" + filename
puts "Full name of the file is #{fullfilename}"
file = File.new("#{fullfilename}", "r")
data = ''
while (line = file.gets)
data += line if line =~ /START/ .. line =~ /EOE/
end
file.close
ERROR:
readfile5.rb:6:in `initialize': No such file or directory -
/apollo/env/A9AdamAdProxy/var/output/logs/service_log.2008-11-21-20
(Errno::ENOENT)
from readfile5.rb:6:in `new'
from readfile5.rb:6
Thanks,
Raju