[Melbourne-pm] View 132 column reports

Brendon Oliver brendon.oliver at redsheriff.com
Wed Mar 2 15:58:31 PST 2005


On Thu, 3 Mar 2005 09:49 am, Jim Kat wrote:

> Is there a Perl script that allows you to view a text
> file 132 column report without wrapping around.
>
> OS: SCO Unix
> TERM=ansi
I doubt that you'll find a ready-written perl script to do this.  What you 
need to do is make sure that your terminal emulator is capable of 
understanding the DECCOLM switch which will allow the terminal to switch 
between 80/132 column mode.

In most cases, the sequence:
        <esc>[?3h
will put the screen into 132-col condensed mode, and
        <esc>[?3i
will switch back to normal 80-col mode.

I spent _ages_ many years go tinkering with this, trying to get 132-col  
reports to view properly in 'less'.  It can be a real PITA to get right (what 
works for one terminal type never necessarily worked for another).

Once you get the sequences working, you might be able to wrap it in a shell 
script:
        echo -e "\033[?3h"
        less $@
        echo -e "\033[?3i"

(FWIW, you can test this in "xterm -132" - it will jump to 132 col wide, but 
it won't switch back to 80-col mode).

Hope this helps.

Cheers,

- Brendon.

-- 
Lewis's Law of Travel:
	The first piece of luggage out of the chute doesn't belong to anyone,
	ever.

 10:57:52 up 3 days, 23:39,  1 user,  load average: 0.26, 0.10, 0.07



More information about the Melbourne-pm mailing list