From owner-freebsd-questions@FreeBSD.ORG Sun Feb 20 00:42:06 2011 Return-Path: Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D596E10656B3 for ; Sun, 20 Feb 2011 00:42:06 +0000 (UTC) (envelope-from sterling@camdensoftware.com) Received: from wh2.interactivevillages.com (wh2.interactivevillages.com [75.125.250.34]) by mx1.freebsd.org (Postfix) with ESMTP id 993BB8FC15 for ; Sun, 20 Feb 2011 00:42:06 +0000 (UTC) Received: from c-24-22-230-24.hsd1.wa.comcast.net ([24.22.230.24] helo=_HOSTNAME_) by wh2.interactivevillages.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1PqxN9-0003VP-2R for freebsd-questions@FreeBSD.ORG; Sat, 19 Feb 2011 16:42:00 -0800 Received: by _HOSTNAME_ (sSMTP sendmail emulation); Sat, 19 Feb 2011 16:42:00 -0800 Date: Sat, 19 Feb 2011 16:42:00 -0800 From: Chip Camden To: FreeBSD Mailing List Message-ID: <20110220004200.GC2495@libertas.local.camdensoftware.com> Mail-Followup-To: FreeBSD Mailing List References: <20110219233736.GA20393@thought.org> <20110219235240.GA2495@libertas.local.camdensoftware.com> <20110220002300.GA21231@thought.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Izn7cH1Com+I3R9J" Content-Disposition: inline In-Reply-To: <20110220002300.GA21231@thought.org> User-Agent: Mutt/1.4.2.3i Company: Camden Software Consulting URL: http://camdensoftware.com X-PGP-Key: http://pgp.mit.edu:11371/pks/lookup?search=0xD6DBAF91 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - wh2.interactivevillages.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - camdensoftware.com Cc: Subject: Re: variable line-display pager? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Feb 2011 00:42:06 -0000 --Izn7cH1Com+I3R9J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 <=3D the number of lines in > > > the file. > > >=20 > > > For instance, say that my xterm/console/"Konsole" is 80x53 lines. > > > My text file is around 200 lines long and I want to use more or less > > > or some GUI pager to display only 15 lines at one time. Tapping the= =20 > > > space bar would display another 15 lines and so on until EOF. Is > > > there a way of doing with with flags of the existing /usr/bin/less > > > or is there some other pager that I can build? > > >=20 > > > thanks, > > >=20 > > > gary > > >=20 > > >=20 > > >=20 > > > --=20 > > > Gary Kline kline@thought.org http://www.thought.org Public Servic= e Unix > > > Journey Toward the Dawn, E-Book: http://www.thought.org > > > The 7.98a release of Jottings: http://jottings.thought.org > > >=20 > > > _______________________________________________ > > > freebsd-questions@freebsd.org mailing list > > > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > > > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freeb= sd.org" > >=20 > > The -z option is supposed to do this: > >=20 > > less -z15 file.txt > >=20 > > But it appears to work only on the second and successive pages. >=20 >=20 >=20 > Oh. So _that's_ why. I tried less -m 15 [because the man pages > sais z=3DN; i just tried what you did with -z15. Full page first > time, 15 lines each spacebar thereafter. >=20 > Zank you, Sir Chip.. Anybody else? I'm loathe to use anything gui, > but here's where I'll be happy w ith something GUI THat i can > squeeze my "15" or small-n lines' worth into. Can'y believe that > there is nothing for all theses years.... I mean, geewhiz! > Any idea where I Should look in ports or how to google this? >=20 >=20 > gary >=20 > >=20 > > --=20 > > Sterling (Chip) Camden | sterling@camdensoftware.com | 2048D/3A978E4F > > http://chipsquips.com | http://camdensoftware.com | http://chipstips= .com >=20 >=20 >=20 > --=20 > Gary Kline kline@thought.org http://www.thought.org Public Service Un= ix > Journey Toward the Dawn, E-Book: http://www.thought.org > The 7.98a release of Jottings: http://jottings.thought.org >=20 > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.o= rg" Is this sort of what you're looking for? #!/usr/bin/env ruby require 'optparse' pagesize =3D 15 optparse =3D OptionParser.new do |opts| opts.banner =3D 'usage: npg [-n pagesize] file...' opts.on('-n', '--numlines pagesize', 'Specify page size in number of line= s') do |n| pagesize =3D n end end begin optparse.parse! rescue OptionParser::InvalidOption, OptionParser::MissingArgument =3D> e puts e puts optparse exit 1 end loop do pagesize.times do if line =3D gets puts line else exit end end print "More..." STDIN.getc end --=20 Sterling (Chip) Camden | sterling@camdensoftware.com | 2048D/3A978E4F http://chipsquips.com | http://camdensoftware.com | http://chipstips.com --Izn7cH1Com+I3R9J Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iQEcBAEBAgAGBQJNYGNYAAoJEIpckszW26+Rer0H/03JJKNuZTCHKoqnFXPxAxIa TUbDty2yTjsOSdVrGojWVb+5tYMqBhWItE2go1TyyVp9EsGjPfBdFBo+ZoYDcvrx 64jIkOCibQ5vZQF4LGwxlRHQrRCZAemucWO1nTD1w2r3ILe+nA8YqNCX5GTn6HsD vuR+FmokUv9jfaV6I+asC5oyABk1blzf611dUvuQcI28FcOpoSx7R3TErbCnyc2+ BlC6+1GI4Uno7zaR1MKFkswn6Q4G9tc7iemz1Ay8sLRFBJDW14e/H0VutTXjLuSI OD7UJRwq9nXoAxepGnw8bi4sytkokzADKRf7LydSLyW/fo483fLJao+KfDsRPWY= =+t2n -----END PGP SIGNATURE----- --Izn7cH1Com+I3R9J--