From: Phy Prabab Date: 2007-03-25T07:54:25+09:00 Subject: Re: Prcoessing outoput from tail --0-2048412795-1174776863=:49746 Content-Type: text/plain; charset=ascii Cool, thanks I will check this out. In the mean time I think I figured out a work around, the only problem left is to figure out how to make this thread-able: IO.popen('tail -F foo.txt') {|file| while line = file.gets puts line end } The "while line" was what helped and I even tried the file rolling and tail complained but picked up the new file, so ijust need to process that error. Do you see any advantage using this over the gem (this way I don't have to make everyone download the gem as well). TIA! Phy ----- Original Message ---- From: Gustav Paul To: ruby-talk ML Sent: Saturday, March 24, 2007 3:41:12 PM Subject: Re: Prcoessing outoput from tail Phy Prabab wrote: > Hello, > > I am trying to figure out how to perpetually process the output from a file. That is I continuously want to process output that is appended to a file and that file could get rolled out at any time. I use popen w/tail, but this opens the file each time and I have to reprocess all the files content. Is there a better way to do this or a library that would help me? I know that I could probably open the file, tack location, and watch the inode to make sure the file has not been rolled, but that amounted to a lot of mistakes and I could never get it work properly. > > Thanks for the help! > Phy > > > > > > ____________________________________________________________________________________ > Now that's room service! Choose from over 150,000 hotels > in 45,000 destinations on Yahoo! Travel to find your fit. > http://farechase.yahoo.com/promo-generic-14795097 > Check out the file-tail gem: http://file-tail.rubyforge.org/ Cheery-o, Gustav Paul ____________________________________________________________________________________ TV dinner still cooling? Check out "Tonight's Picks" on Yahoo! TV. http://tv.yahoo.com/ --0-2048412795-1174776863=:49746--