files save disk space.
But compressed files aren't as convenient to work with: you have to
uncompress them before you can read or edit them.
script (also named zpg
makes the job easier.
It uncompresses one or more files and feeds them to a pager:
(The script uses GNU gzcat
, which can read both
The script can also page through files that have been made printable by
cat -v -t -e
This is a safe way to page through files that might have unprintable
characters that could mess up your terminal if they weren't filtered.
Finally, the script can page through the latest revision of an
RCS file (20.14
Here's an example.
Let's page through the gzip
ped files data.gz
Then we'll read the suspiciously named file Ex034912
to see what's in it:
zmore data ../summary
You don't need to type the .gz
...First screen of data.gz, uncompressed
...The rest of data.gz, uncompressed
zmore: Press RETURN to see next file, '../summary':
...First screen of ../summary.gz, uncompressed
...First screen of Ex034912, filtered with cat -t -v -e
The same script file does all those things.
It's written to have eight other
, and rcsless
The script tests the name it was called with, from
, to decide
whether to use gzcat
, cat -t -v -e
, and which pager to run.
This trick saves disk space.
You can change the pagers used by modifying the script and adding or
removing links to it.
The absolute pathnames at the start of the script may need to be changed
for your system.
Most pager programs can't back up or move around as easily when they're
reading from a pipe.
You can use a temporary file instead.
That's not as efficient as using a pipe, but it's good to be able to do.
that, add the following two lines after the second case
trap 'rm -f $temp; exit' 0 1 2 15
And change this line inside the while
loop, around line 38:
*) $cat "$1" | $prog $opts ;;
to these three lines:
*) $cat "$1" > $temp
$prog $opts $temp