From: Robin Stocker Date: 2006-11-05T15:18:12+09:00 Subject: Re: How could I do this search using .scan - I am a newbie Kevin Stolt wrote: > Hi, > > I am new to ruby and I have been search and pulling my hair to do this > using .scan? > > I have file which contains.....(this is an example) > > bat rat cat mat pat > mat sat put tomorrow today > > > So how could I search so I could get the values in the second column? > > I want to find "rat" and "sat" for example. I searched many time and > read many things but I can't figure out. I hope someone would be kind > enough to help me or show me the correct direction. > > any help is appreciated. > > thanks in advance > kev > You could use String#split like this: ARGF.each_line do |line| puts line.split[1] end Robin