linux - How to print file content in parts to the screen? -


i trying store command output file (that works fine) , want do, display file content screen. problem want displayed in parts (for example 20 lines @ time) , let user press [enter] or key continue next part. thinking piping file content more displays whole file content @ once instead of doing parts.

here part of code responsible opening file, writing it, , displaying on screen.

open file, '>', $filename; print file @command;  open file, '<', $filename; while (<file>) {     open more, '| more';     print more; } close more; close file; 

use strict; use warnings;  @command = map "output line $_\n", 1..100;  $page_size = 20; $n = 0;  $line (@command) {     print $line;     $n ++;     if ($n % $page_size == 0) {         print "--more--";         <>;     } } 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -