I’m trying to pipe the output of a command like this:
some_command | ruby -ne "puts $_ if some_condition($_)"
However, all I see are empty lines. Where is each line being stored?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This should work just fine. As an example,
ls | ruby -ne 'puts $_ if $_[0] == "r"'prints just what I’d expect. You should ensure that yoursome_commandis in fact outputting to stdout.