From: Rodrigo Bermejo Date: 2009-01-10T04:21:20+09:00 Subject: Re: finding a range of lines from a text document Rodrigo Bermejo wrote: > Adam Akhtar wrote: >> Can anyone help me? ill try and keep it short and to the point. >> >> wish : to be able to grab select lines from a text document which meet >> some criteria. >> >> current idea: simply read the file as one big string and use a regexp to >> find all text between a /marker_one/ and /marker_two/ >> >> but: in general ill only be ever manipulating a single line at a time so >> simply using readlines to store a file into an array and they >> manipulating that seems a lot easier than storing a file as a string and >> figuring out where one line starts and one line ends. >> >> file example: >> >> ### next actions ### >> >> ### project: buy pc ### >> 3 read posts on hardforum >> 4 use froogle.com >> 3 buy parts >> 4 build pc >> 5 install os >> >> ### project: become millionaire ### >> 2 get job >> 3 save money >> 4 start own business >> 3 sell business >> 3 sell drugs >> >> ### project: have the biggest collection of pants on earth >> 3 learn about pants >> 4 become a member of pantsinc.net >> > a better solution will be to have your project data in a "self-descriptive" format like XML (or YAML) sooner or later you will have to use XML .. it's a good chance for you to learn it and added it to your toolbox -r. -- Posted via http://www.ruby-forum.com/.