The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Seeing the screen output beyond the scroll capability for the last run command bimukt UNIX for Dummies Questions & Answers 1 05-02-2008 01:22 AM
lpr- how to print from page to page naamas03 Shell Programming and Scripting 4 12-26-2007 02:30 AM
scroll bars in Exceed X-windows yankee428 UNIX for Dummies Questions & Answers 7 08-18-2005 05:17 AM
linking unix generated text file to html page alexd Shell Programming and Scripting 1 11-13-2002 08:21 AM
Text Modification and page I/O error jyotipg High Level Programming 4 10-05-2001 06:43 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-13-2001
Registered User
 

Join Date: Dec 2001
Location: Overland Patrk
Posts: 62
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.
Forum Sponsor
  #2 (permalink)  
Old 12-14-2001
LivinFree's Avatar
Goober Extraordinaire
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
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 (permalink)  
Old 12-14-2001
Registered User
 

Join Date: Dec 2001
Location: Overland Patrk
Posts: 62
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 (permalink)  
Old 12-14-2001
Neo's Avatar
Neo Neo is offline
Administrator
 

Join Date: Sep 2000
Location: Asia Pacific
Posts: 4,304
Perhaps a command line filter using tail -f ?

Could this work for you?
  #5 (permalink)  
Old 12-14-2001
Registered User
 

Join Date: Dec 2001
Location: Overland Patrk
Posts: 62
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 (permalink)  
Old 12-18-2001
LivinFree's Avatar
Goober Extraordinaire
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
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 02:13 AM.
  #7 (permalink)  
Old 12-18-2001
LivinFree's Avatar
Goober Extraordinaire
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
Exclamation 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...
Google The UNIX and Linux Forums
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:52 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0