controlling screen display


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting controlling screen display
# 1  
Old 02-07-2002
Question controlling screen display

How can I control the screen output when trying to read a large file onto the screen x number of lines at a time. I'm trying to use this is a bourne shell script. I want to display 10 lines of a file, pause the screen so that a user can read the file, and then display the next 10 lines of the file, pause .....etc. I have tried:
using head and tail in a loop. There also seems to be a problem controlling the exact placement of the file contents. I've used tput cup r c; the screen placement varies. Any thoughts will be appreciated!
# 2  
Old 02-07-2002
Use more -10 - read the man page on more and if your system has it man less.
thehoghunter
# 3  
Old 02-08-2002
Perderabo posted an excellent script to do just that. He points out that head / tail is very inefficient, so his works without repeated disk reads...

Check it out here:
https://www.unix.com/showthread.php?s...2056#post12056

Good stuff!
# 4  
Old 02-08-2002
controlling screen display

That's not quite what I had in mind. I need to show only 10 lines at a time. more and / or less seem to write to the whole screen and then scroll by the specified number of lines. I can't even erase a portion of the screen with this method?

the original question was: how can a put 10 lines from a log file on the screen at one time, pause the screen and prompt the user to press some key to see the next 10 lines.
# 5  
Old 02-08-2002
If you do it from a script, then you could clear the screen, show the first ten lines, prompt for a return from the user and then clear the screen and show the next 10 lines. You would have to create a script utilizing some of these commands:
head and/or tail
read
clear

There would be some thought needed for the logic of this but it isn't too hard.

If you are wanting to control exact positions within a screen, then you would have to insure of the terminal type and issue escape sequences to control the cursor position.
thehoghunter
# 6  
Old 02-08-2002
How about:
page -n10 filename
# 7  
Old 02-08-2002
Hammer & Screwdriver screen display

Thanks for the input guys! This is what I ended up doing at it seems to work, still need to test it a little more.

scr_fill=`cat filename | wc -l`
LC=10
LnCnt=$LC

while [ $scr_fill -gt $LC ]
do
tput clear
tput cup 0 0
head -$LnCnt filename | tail -$LC
tput cup 20 20
echo "Press enter for the next screen"
read junk
LnCnt=`expr $LnCnt + $LC`
scr_fill=`expr $scr_fill - $LC`
done
tput clear
tput cup 0 0
head -$LnCnt filename | tail -$LC
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

"rhgb quiet" controlling the display of commands in single user mode ?"rhgb quiet" controlling the d

Why does removing "rhgb quiet" from the kernel boot parameters control whether or not the commands I enter are displayed in single user mode ? For instance, if I do not remove "rhgb quiet", when I am in single user mode, whatever command I type will not be displayed on the screen. The... (0 Replies)
Discussion started by: Hijanoqu
0 Replies

2. UNIX for Advanced & Expert Users

How to display the files on screen

I connect via vnc to a linux computer. after a logout, I cannot see the files on the screen (although i can see the screensaver). I can open a terminal and see the files etc. How can i see the files on the screen again? (5 Replies)
Discussion started by: FelipeAd
5 Replies

3. Shell Programming and Scripting

Display a menu on bottom right of screen

Hi, I have a menu of around 10 lines with options. I want to display it in bottom right corner of screen for better display. I can do it with clear screen. But I don't want to use it, because it will clear the existing text. After one choice from menu is executed, the menu should just place... (3 Replies)
Discussion started by: som.nitk
3 Replies

4. Ubuntu

Virtual Box Screen Display

Hi, Anyone can help me on how to return back to normal size not the full size of my virtual box screen display and also display the menu bar from the top. Thanks in Advance. (4 Replies)
Discussion started by: dba_macau
4 Replies

5. AIX

Increasing screen display size

Hi, How can i increase the size of my display on AIX 5.3.What i mean is e.g if i do and ps -ef i would get some like: /data/app/oracle/product/10.2 /usr/bin/ksh /usr/local/bin/s i want it to show the whole thing on the screen without cutting it,because there is still space on the screen... (0 Replies)
Discussion started by: sellafrica1
0 Replies

6. AIX

CDE running but not display on screen

Runing p550Q via HMC I'd like to start using graphic interface CDE: lslpp -l | grep X11.Dt* X11.Dt.ToolTalk -- AIX CDE ToolTalk Support X11.Dt.bitmaps -- AIX CDE Bitmaps X11.Dt.helpmin -- AIX CDE Minimum Help Files X11.Dt.helprun -- AIX CDE Runtime Help X11.Dt.lib -- AIX CDE... (0 Replies)
Discussion started by: silves
0 Replies

7. Shell Programming and Scripting

screen display help

Hello All, I have a file that is formatted like this 1234556 1234567 1234588 1123888 1999999 1010101 1919191 1919191.... for a total of 26000 + lines how do I get a script to read lets say 50 lines at a time and display the output to the screen in column format around 5 or 6... (2 Replies)
Discussion started by: zilla30066
2 Replies

8. UNIX for Dummies Questions & Answers

how to concatenate two command in one line and get the display in one screen

Hi, I would like to know , how to concatenate two command in one line and get the display in one screen for eg command 1 : ls -l /data/logs command 2 : ls -l /data/errors output shd be /data/logs /data/errors xx-xx-xx-xx abc.log xx-xx-xx-xx... (9 Replies)
Discussion started by: vasikaran
9 Replies

9. Shell Programming and Scripting

file display on screen on pg at time

hi can some body please help me...i'm been sitting here trying to figure how to do this..but still don't understand. Like each type of *.src (if any) in the given directory will be displayed on the screen one page at a time.... can someone explain how to do this..plz (1 Reply)
Discussion started by: zip_zip
1 Replies

10. Shell Programming and Scripting

Simple Perl Script to Screen Display

$number_clients++; print("Creating client $number_clients\r"); I have been using the above to increment on the screen as the script increments throughout a while loop. What I would like to know is what is the trick to keep the last one on the screen without printing it again? Ie ... (1 Reply)
Discussion started by: Shakey21
1 Replies
Login or Register to Ask a Question