[wtr-general] Re: How to delete a line in a file?

2009-06-12 Thread Željko Filipin
This looks like a question that is not really Watir related. Maybe somebody answers, but you will probably get more replies at ruby forums or http://stackoverflow.com/ Željko -- http://watirpodcast.com/ --~--~-~--~~~---~--~~ You received this message because you

[wtr-general] Re: How to delete a line in a file?

2009-06-12 Thread Felipe Knorr Kuhn
Hello, I use the following in my scripts: require yaml @urls = YAML.load_file(urls.txt) @url = @urls.delete_at(0) File.open('urls.txt', 'w') do |out| YAML.dump(@urls, out) end FK 2009/6/12 Wesley Chen cjq@gmail.com Hi, Guys, I would like to read from a file, when I read a line, I

[wtr-general] Re: How to delete a line in a file?

2009-06-12 Thread Wesley Chen
Thank you, guys, I think it is better if I use excel to do that, although it is more complex. Thanks. Wesley Chen. On Fri, Jun 12, 2009 at 8:38 PM, Felipe Knorr Kuhn fkn...@gmail.com wrote: Hello, I use the following in my scripts: require yaml @urls = YAML.load_file(urls.txt) @url =

[wtr-general] Re: How to delete a line in a file?

2009-06-11 Thread Wesley Chen
The file format is txt format. Thanks. Wesley Chen. On Fri, Jun 12, 2009 at 12:12 PM, Wesley Chen cjq@gmail.com wrote: Hi, Guys, I would like to read from a file, when I read a line, I would like to delete this line in the file, until all the file is read. Any suggestion would be

[wtr-general] Re: How to delete a line in a file?

2009-06-11 Thread Wesley Chen
There is a method I can do this: require 'watir' $ie=Watir::IE.find(:title,/Home/) filename=c:\\url_list.txt arr1=File.readlines(filename) arr2=arr1.dup arr1.each {|line| begin $ie.goto(line) $ie.wait file=File.open(filename,w) arr2.shift file.puts arr2