#! /usr/bin/ruby # # $Id: helpparse.rb,v 1.1 2002/06/24 10:46:51 wrk Exp $ # $Source: /home/cvs/opensource/rock/person/pjotr/guide.DEV/helpparse.rb,v $ helpfn=ARGV[0] search=ARGV[1] stream = File.new(helpfn) hasindex=false while line = stream.gets if line =~ /^\d+(\.\d+)+\. / title = $' # ' if title =~ /#{search}/ if hasindex # if stream.gets =~ /\=+/ if stream.gets # skip one line while line = stream.gets if line =~ /^\d+(\.\d+)+/ break end print line end break else raise "Problem with file" end else hasindex = true end end end end