Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Feb 2011 16:44:32 -0800
From:      Chip Camden <sterling@camdensoftware.com>
To:        FreeBSD Mailing List <freebsd-questions@FreeBSD.ORG>
Subject:   Re: variable line-display pager?
Message-ID:  <20110220004432.GD2495@libertas.local.camdensoftware.com>
In-Reply-To: <20110220004200.GC2495@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>

next in thread | previous in thread | raw e-mail | index | archive | help

--HWvPVVuAAfuRc6SZ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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 <=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 th=
e=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 Serv=
ice 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@fre=
ebsd.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://chipsti=
ps.com
> >=20
> >=20
> >=20
> > --=20
> >  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
> >=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=
.org"
>=20
> Is this sort of what you're looking for?
>=20
> #!/usr/bin/env ruby
> require 'optparse'
>=20
> pagesize =3D 15
>=20
> optparse =3D OptionParser.new do |opts|
>   opts.banner =3D 'usage: npg [-n pagesize] file...'
>=20
>   opts.on('-n', '--numlines pagesize', 'Specify page size in number of li=
nes') do |n|
>     pagesize =3D n.to_i
>   end
>=20
> end
>=20
> begin
>   optparse.parse!
> rescue OptionParser::InvalidOption, OptionParser::MissingArgument =3D> e
>   puts e
>   puts optparse
>   exit 1
> end
>=20
> loop do
>   pagesize.times do
>     if line =3D gets
>       puts line
>     else
>       exit
>     end
>   end
>   print "More..."
>   STDIN.getc
> end
>=20
> --=20
> Sterling (Chip) Camden | sterling@camdensoftware.com | 2048D/3A978E4F
> http://chipsquips.com  | http://camdensoftware.com   | http://chipstips.c=
om


Oops -- code corrected above.

--=20
Sterling (Chip) Camden | sterling@camdensoftware.com | 2048D/3A978E4F
http://chipsquips.com  | http://camdensoftware.com   | http://chipstips.com

--HWvPVVuAAfuRc6SZ
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iQEcBAEBAgAGBQJNYGPwAAoJEIpckszW26+RGN4H+gIZxb1LN3fZPBSXzYR0ic0l
cmo+p18mmV4WHB3JX8+Dm9jnS4qvVEsgpZNDORhm00y0vYsHc8hT4Qik6VdaIIHi
yH5lEalcChioSECk2sNts0U1Bhfp9P61WOrDSDQUyReShWkQKya/phEn5XK4Fy4A
9dWZT6QPJU0Nlgm+7hPRb65CLwD4fiGqKoMdBhLoVfZG0LVdaJ8X9z5ZmecqtSdU
o6SFceBZdvRcs6eBhS4ddjEEUg/t4qxRhVh3FMsSNaZrS2Pl50nyTIHMm9de+iho
VsYW7NOX2Ht1qDY4wSz9gWwcaDTPDDDNxAtPwSL0VelwDOha7PJ06KA37x+nW7A=
=6L3F
-----END PGP SIGNATURE-----

--HWvPVVuAAfuRc6SZ--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110220004432.GD2495>