![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
||||
| 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 03: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 09:21 AM |
| Text Modification and page I/O error | jyotipg | High Level Programming | 4 | 10-05-2001 06:43 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
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
|
||||
|
||||
|
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
|
|||
|
|||
|
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
|
||||
|
||||
|
Perhaps a command line filter using tail -f ?
Could this work for you? |
|
#5
|
|||
|
|||
|
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
|
||||
|
||||
|
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
Last edited by LivinFree; 12-18-2001 at 03:13 AM. |
|
#7
|
||||
|
||||
|
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 |
| Thread Tools | |
| Display Modes | |
|
|