lesspipe [Was: Re: OpenSSH]

From: Jean-Pierre Radley (jpr_at_jpr.com)
Date: 09/22/03


Date: 21 Sep 2003 18:20:22 -0400

Bela Lubkin typed (on Sun, Sep 21, 2003 at 08:02:57PM +0000):
| willjay wrote:
|
| > What's really going on here, is somebody is really proud that they we able
| > to get bzip to compile on openserver and now to justify their effort they
| > are craming it down our throats.
|
| Now that's just silly. `bzip2` is one of the most portable programs
| ever written. Not that this is difficult, since all of its real work is
| computational; it needs to do only the simplest of system calls. It's
| so portable that it doesn't even have a `configure` script, and doesn't
| need one.
|
| JPR would hardly need to be proud of unpacking the source and typing
| `make; make install`.

After doing just that, I did perform a minimally original piece
of work, which was to revise my /usr/local/bin/lesspipe script,
effective once one has set the environment variable LESSOPEN to
the value "|lesspipe %s".

        #!/bin/ksh
        #@(#) lesspipe; JPRadley 17Nov 99
        #@(#) invoked by 'less' when the env.var. LESSOPEN='|lesspipe %s'

        case "$1" in
                *.gz|*.tgz|*.Z) zcat $1 2>/dev/null ;;
                *.bz2|*tb2) bzcat $1 2>/dev/null ;;
        esac

Then 'less' can display squished files just by typing, e.g.,

        less filename.bz2

It obviates the need for 'zless', usually supplied by gzip source, and
which doesn't cope with bzip2 files.

-- 
JP


Relevant Pages

  • Re: On topic - great software for an MT
    ... professional expander, and, believe me, you really, really, really want ... to simply typing a few characters and hitting a double space or F10. ... been completely blown away by the results, a single script that lets ...
    (sci.med.transcription)
  • Re: Help!! crazy awk unix shlle script
    ... Execute teh program by typing: ... main.ksh data HAIR AGE EYES ... colon-separated field names, ... write a script, named extract_columns, that prints out the values ...
    (comp.lang.awk)
  • Re: convert hex to decimal?
    ... >> Not when you count time for typing, debugging, etc. ... > in a script), ... Michael Heiming - RHCE ...
    (comp.unix.shell)
  • Re: On topic - great software for an MT
    ... Now, I wonder, does it work across any programs running under ... > paste into an EMR, would there be a way to have this program automatically ... and then you can launch the script from the typing line ... by typing a few letters and/or numbers and your trigger key (a function key ...
    (sci.med.transcription)