In shell, I can do
$ cat name_of_file_with_a_lot_of_text | grep "What I am looking for"
Inside the Rails Console, can I achieve something similar, say when I run a command and the output is huge, especially say a DB query.
I am aware of outputting it as YAML but that Is not what I am looking for.
Thanks.
Yes, you can. The method is called gr… wait for it …ep. Ruby’s
grepworks onString,Arrayand many other built-in objects. For example to get allto_xxxmethods of a number, just do: