On Nov 20, 8:06 am, Vamsi Krishna <[EMAIL PROTECTED]>
wrote:
> hi all,
>
>  i need to grep a word count from a text file and i want to display the
> count.
>  i need all the above in a rake file , i tried it by using
>
>    today_count= system("grep -R 'time' oct_10.txt | grep -R 'hi' | wc
> -l")
>    puts "today count is :#{today_count}"
>
>   but today_count returns 'true' instead of count.
>
>   plz reply ASAP.
>
> Thanks..
> --vamsi.
> --
> Posted viahttp://www.ruby-forum.com/.

Try backticks instead:

output = `grep -R 'time' oct_10.txt | grep -R 'hi' | wc`

backticks will return whatever went to stdout.

For system(), rtfm: http://ruby-doc.org/core/

Jeff
p.s. Please don't say "reply ASAP" when posting. Everyone here is
donating their free time and energy already. :-)

purpleworkshops.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to