Derek Smith wrote: > Hi All, > > I had played in Ruby a while and could not get this to work. > > df -m > Filesystem 1M-blocks Used Avail Capacity Mounted on > /dev/concat/v109-v112a 7931 2619 4677 36% / > > [root@vr /usr/local/vrep/OS_scripts]# df -k |awk '{print $4}' > Avail > 4789776 > > dfstr = Array.new You chose a name that implies the variable is a string. And then you make it an array. That makes no sense. And wouldn't it have been easier to say dfstr = [] ? > dfstr << %x(df -m) At this point in the program, add this line: p dfstr What does that tell you? > dfstr.each do |line| > puts line if line =~ /(\d+)%/ > end > > Since its one line, it of course prints it all. > I then tried: > > dfstr.each do |line| > puts line.split[3] > end > > And it only prints "Avail" Your array contains only one string. > > I then tried: > > puts dfstr.scan(/Avail.*/) > > and > > puts dfstr.split(/\d+/)[3] > > with NO success. That means Ruby is working properly. > > Goal is to get certain data columns such as Used Avail Capacity. > > thank you! --