문제

I am trying to parse some access logs with Ruby, the file itself is 363MB. I'm working in IRB and when I try to assign the text from the document to a variable data = logs.read it begins returning all the text into the interpreter, which at 363MB is an issue.

How do I assign the contents of a file to a variable without returning the value back in the interpreter?

도움이 되었습니까?

해결책

Start your irb as below :

irb --simple-prompt --noecho

  • --simple-prompt is to get the IRB prompt as >>
  • --noecho is to off the echo on IRB

Here is an example:

C:\>irb --simple-prompt
>> x = 2
=> 2
>> exit

C:\>irb --simple-prompt --noecho
>> x = 2
>>

다른 팁

You can use ; and then enter any operator, for example:

data = logs.read; nil

It will output just nil.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top