Read from a file into an array and stop if a ":" is found in ruby
Posted
by Minky
on Stack Overflow
See other posts from Stack Overflow
or by Minky
Published on 2010-04-23T11:02:28Z
Indexed on
2010/04/23
11:03 UTC
Read the original article
Hit count: 258
Hi! How can I in Ruby read a string from a file into an array and only read and save in the array until I get a certain marker such as ":" and stop reading?
Any help would be much appreciated =)
For example:
10.199.198.10:111 test/testing/testing (EST-08532522)
10.199.198.12:111 test/testing/testing (EST-08532522)
10.199.198.13:111 test/testing/testing (EST-08532522)
Should only read the following and be contained in the array:
10.199.198.10
10.199.198.12
10.199.198.13
© Stack Overflow or respective owner