Visit Our UNIX and Linux User Community


Is there a way scroll text instead of page?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Is there a way scroll text instead of page?
# 1  
Old 12-14-2001
Is there a way scroll text instead of page?

Is there a way to slowly scroll the output of a file instead of page or cat ?

Instead of one page at a time, I would like to slowly scroll the displayed output of the file.
# 2  
Old 12-14-2001
Well, instead of using more, you can use less, if it's installed on your box.
You could also use more, and use the "j" and "k" keys to scroll line-by-line up and down.

Hope that helps.
# 3  
Old 12-14-2001
Question more won't work for me.

I want the screen to scroll through the text automatically without keyboard intervention for the duration of the display. I didn't know if it was possible to do that or not.
# 4  
Old 12-14-2001
Perhaps a command line filter using tail -f ?

Could this work for you?
# 5  
Old 12-14-2001
How would a filter be done with tail?

How would I do that?

Just another brainstorming idea but, would I be able to read a file only say 5 lines at a time, and then sleep for 1 second before reading the next 5 lines? That may be an option but I am unsure How I would do that. Suggestions anyone?

Thanks,
# 6  
Old 12-18-2001
Well, five at a time, then sleep for one second was a little too fast for me, but feel free to change it to what you need:
Code:
#!/bin/sh
if [ "$#" -ne "1" ]; then
echo
echo "Usage: `basename $0` /path/to/text/file"
echo
exit 1
fi
if [ ! -f "$1" ]; then
echo
echo "File does not exist!"
echo
exit 2
fi

Line_total=`wc -l $1 | awk '{print $1}'`
Line_end=5

##
## See the next post for a fix to this
## next piece. Important!
##
until [ "$Line_end" -ge "$Line_total" ];
do
head -n${Line_end} $1 | tail -n5
Line_end=`expr ${Line_end} + 5`
sleep 4
done

That's just a quickie... It could be made much better (with command-line options and everything) if you want to put some time into it... It should be portable. Please let me know if it doesn't work for some reason.

Last edited by LivinFree; 12-18-2001 at 07:13 AM..
# 7  
Old 12-18-2001
Error Oops

Oops, I'm a bonehead...

The line:
until [ "$Line_end" -ge "$Line_total" ];
should have a "-gt" in the middle, not a "-ge"... It could cause you not to get the full results of the file...

Also, head may (depending on your system) have a hard-limit set. You may not be able to use this script with files over a certain length (I think it's 500 lines on some systems)...

Still, hope it helps...
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #474
Difficulty: Easy
Binary numbers are expressed in terms of a power of 2 instead of a power of 10.
True or False?

10 More Discussions You Might Find Interesting

1. Forum Support Area for Unregistered Users & Account Problems

UZoo ad disabling scroll on page

The ad for UZoo disables scrolling. Very annoying (0 Replies)
Discussion started by: Unregistered
0 Replies

2. UNIX for Beginners Questions & Answers

Converting text file to html page

Hello Everyone, I have the following text file with the each field separated by newline Text file P file1-en-us_US-20170718T150157Z.json Wed 19 Jul 2017 06:10:13 AM EDT P file2-en-us_US-20170718T160150Z.json Wed 19 Jul 2017 06:10:13 AM EDT P file3-en-us_US-20170718T163218Z.json Wed... (9 Replies)
Discussion started by: nextStep
9 Replies

3. Shell Programming and Scripting

Copy text from web page and add to file

I need help to make a script for Ubuntu to OSCam that copy the text on this website that only contains "C: ip port randomUSERNAME password" and want to exclude the text "C:" and replace the rest with the old in my test.server file. (line 22) device = ip,port (line 23) user =... (6 Replies)
Discussion started by: baxarn
6 Replies

4. Shell Programming and Scripting

Web page with picture, text, php function

Hello. I'm trying to create a web page which the presentation is as follows: 1 ) at the top of page an image 2 ) below the text 3 ) to complete a php function that returns information. I tried different things but none work. Script 1: <!DOCTYPE html> <html> <head> <style> div { ... (5 Replies)
Discussion started by: jcdole
5 Replies

5. Shell Programming and Scripting

Grep text matching problem with script which checks if web page contains text.

I wrote a Bash script which checks to see if a text string exists on a web page and then sends me an email if it does (or does not e.g. "Out of stock"). I run it from my crontab, it's quite handy from time to time and I've been using it for a few years now. The script uses wget to download an... (6 Replies)
Discussion started by: gencon
6 Replies

6. UNIX for Dummies Questions & Answers

Possible to download web page's text to a file?

Hi, Say there is a web page that contains just text only - that is, even the source code is just the text itself, nothing more. An example would be "http://mynasadata.larc.nasa.gov/docs/ocean_percent.txt" Is there a UNIX command that would allow me to download this text and store it in a... (1 Reply)
Discussion started by: Breanne
1 Replies

7. Solaris

How to scroll through the man page in Solaris

Hey All, I generally login to the Solaris box using Putty. But when I read a man page, I am not being able to scroll line by line using traditional 'j' or 'k' keys. Any idea about how can we scroll through line by line while reading a manage page over Putty (2 Replies)
Discussion started by: paragkalra
2 Replies

8. HP-UX

Pid X killed due to text modification or page I/O error

Hello everybody, I have a HP-UX B.11.11. I had one disk and added one new. When trying to configure the second disk Not Using the Logical Volume Manager(from SAM) I have this error: Pid X killed due to text modification or page I/O error I tryed to add another partion on the first disk,... (5 Replies)
Discussion started by: savus
5 Replies

9. Shell Programming and Scripting

linking unix generated text file to html page

i am trying to link the text files that i generated from my shell script to an html page, to that i can view them using a browser, like internet explorer. i want to open the text files in html page when i enter a command to view the text file from the shell command. please could anyone help... (1 Reply)
Discussion started by: alexd
1 Replies

10. Programming

Text Modification and page I/O error

Hi!, while launching my C application on HP-UX 10.2 workstation, I get the following error message sometime: Pid 9951 killed due to text modification or page I/O error Could someone tell me what does this error means?? and how is this caused? Thanx in Advance, JP (4 Replies)
Discussion started by: jyotipg
4 Replies

Featured Tech Videos