Date: Sun, 20 Feb 2011 00:42:35 -0800 From: Gary Kline <kline@thought.org> To: FreeBSD Mailing List <freebsd-questions@FreeBSD.ORG> Subject: Re: variable line-display pager? Message-ID: <20110220084235.GA30569@thought.org> In-Reply-To: <20110220004432.GD2495@libertas.local.camdensoftware.com> References: <20110219233736.GA20393@thought.org> <20110219235240.GA2495@libertas.local.camdensoftware.com> <20110220002300.GA21231@thought.org> <20110220004200.GC2495@libertas.local.camdensoftware.com> <20110220004432.GD2495@libertas.local.camdensoftware.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Feb 19, 2011 at 04:44:32PM -0800, Chip Camden wrote: > Quoth Chip Camden on Saturday, 19 February 2011: > > Quoth Gary Kline on Saturday, 19 February 2011: > > > On Sat, Feb 19, 2011 at 03:52:40PM -0800, Chip Camden wrote: > > > > Quoth Gary Kline on Saturday, 19 February 2011: > > > > > Need help findind a way of using existing unix utilities to diplay > > > > > chunks of N lines of a text files. Here N <= the number of lines in > > > > > the file. [[ ..... ]] > > > > #!/usr/bin/env ruby > > require 'optparse' > > > > pagesize = 15 > > > > optparse = OptionParser.new do |opts| > > opts.banner = 'usage: npg [-n pagesize] file...' > > > > opts.on('-n', '--numlines pagesize', 'Specify page size in number of lines') do |n| > > pagesize = n.to_i > > end > > > > end > > > > begin > > optparse.parse! > > rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e > > puts e > > puts optparse > > exit 1 > > end > > > > loop do > > pagesize.times do > > if line = gets > > puts line > > else > > exit > > end > > end > > print "More..." > > STDIN.getc > > end > > > > -- > > Sterling (Chip) Camden | sterling@camdensoftware.com | 2048D/3A978E4F > > http://chipsquips.com | http://camdensoftware.com | http://chipstips.com > > > Oops -- code corrected above. > > -- > Sterling (Chip) Camden | sterling@camdensoftware.com | 2048D/3A978E4F > http://chipsquips.com | http://camdensoftware.com | http://chipstips.com Yes, this is much nicer that the more -15 that messes up the text with it's [MORE...] white within black. But here you can't just tap the spacebar; is there a way around that <cr> and turning it into a space...? Also, can you insert "^+++" text "^+++" top And bottom? Pretty sure that the user would have the large font to read aloug with that espeak read to hijm. Having the top/bottom delimiters might make scanning the text easier. (It messed up with more. Anyway, thanks foe something that actually works, :_) gary -- Gary Kline kline@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 7.98a release of Jottings: http://jottings.thought.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110220084235.GA30569>