From: Joao Pompei Date: 2010-05-07T05:37:56+09:00 Subject: Parse file to a hash Hello! I need to parse a specific file to a hash. This is a sample of the file: blablabla...... } -- 1.3.6.1.4.1.000.6.1.2.2.11.1 mASLocked OBJECT-TYPE SYNTAX INTEGER ......blablabla And my hash has to be like this: my_hash = { 'mASLocked' => '1.3.6.1.4.1.000.6.1.2.2.11.1' } The hash will have about 400 items on it. The only 2 things that are standard on the file are the '-- ' before the number and the string 'OBJECT-TYPE' on the second line. I saw a lot of parse examples but they always use something like DATA SEPARATION DATA. This is not my case since the identifier is in one line before the data and in the other line after the data I want. I am thinking of doing something very ugly here. Any ideas to save me from do a ugly Frankenstein (and probably wrong) code? Thanks -- Posted via http://www.ruby-forum.com/.