On Aug 15, 10:18 pm, Michael Linfield <globyy3... / hotmail.com> wrote: > Alex Gutteridge wrote: > > On 16 Aug 2007, at 13:29, Michael Linfield wrote: > > >> data from, then at the end of the program delete Blah1.csv ? > > Sure, use tempfile, but I think botp has shown why you don't really > > need the temporary file (unless there's part of this problem I'm not > > understanding): > > the reason im going to use a tempfile is because thers going to be a > per'se blah2 blah3 ect. So im storing the grep from blah1, blah2, and > blah3 in different files so i can later pull the data from those files > to graph each line with ruport. each line will represent Blah1 Blah2 > Blah3 ect. So unless i can shove the grep output into an array, and each > line be an element, ive gotta use a tempfile. Maybe theres a better way? > > If thers a better approached im all ears :D > > Thanks a ton btw, you all have been a tremendous help. > -- > Posted viahttp://www.ruby-forum.com/. Not sure if this is what you are looking for, but if you are trying to search a file placing the lines that contain "Blah1" into a file called "Blah1.csv", the lines containg "Blah2" into a file called "Blah2.csv" etc, Rio might help: require 'rio' rio('filename.csv').chomp.lines(/Blah[^,]*/) do |line,m| rio(m) + '.csv' << line + $/ end Then again it might not.