Try backticks instead:
output = `grep -R 'time' oct_10.txt | grep -R 'hi' | wc`
backticks will return whatever went to stdout.
For system(), rtfm: Index of Files, Classes & Methods in Ruby 3.1.2 (Ruby 3.1.2)
Jeff p.s. Please don't say "reply ASAP" when posting. Everyone here is donating their free time and energy already.
purpleworkshops.com