Re: Read 20 lines when pressing n for next



On Tue, 29 Apr 2008 18:21:12 -0700 (PDT) s9uzaa@xxxxxxxxx wrote:

s> I would like to write a perl script with the following criteria match.
s> 1. open any text file taken the name from the command line.
s> 2. read top 20 lines and stops, then
s> 3. ask to press letter "n or p" (for next/previous) to print next or
s> previous 20 lines.
s> would appreciate any kind of help.
s> 4. must have subroutine used.

perl -e'sub { exec less => -20 => @_}->(@ARGV)' FILE1 FILE2 ...

Unfortunately this uses SPACE or `f' instead of `n' to advance to the
next 20 lines, but I think it meets all the other criteria.

Good luck!
Ted
.