FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 05-13-2012, 05:57 AM
Paul Colquhoun
 
Default less file.html

On Sun, 13 May 2012 05:12:59 Stroller wrote:
> On 13 May 2012, at 00:22, Alex Schuster wrote:
> > …
> >
> >>> You can set LESSIGNORE='*.htm*'. This environment variable is used by
> >>> the lesspipe command, which is invoked by less and filters the input
> >>> file before giving it to less itself.
> >>
> >> Contrary to my previous email, sent in error, that does NOT work.
> >>
> >> Did you check this yourself?
> >
> > Yes. I did not know about this mechanism before, but 'env|grep -i less'
> > showed the LESS and LESSOPEN environment variable, so I learnt about the
> > lesspipe command. lesspipe -h gives a little info, LESSIGNORE is shown
> > there.
>
> I have here now:
>
> $ env | grep -i less
> PAGER=/usr/bin/less
> LESS=-R -M --shift 5
> LESSOPEN=|lesspipe %s
> LESSIGNORE=*.htm*
> $


On my system, I get this as the lesspipe help message:

#########################################
[paulcol@bluering ~]
[Sun May 13 10:26:09]$ lesspipe --help
lesspipe: preproccess files before sending them to less

Usage: lesspipe <file>

lesspipe specific settings:
LESSCOLOR env - toggle colorizing of output (no/yes/always)
LESSCOLORIZER env - program used to colorize output (default:
code2color)
LESSIGNORE - list of extensions to ignore (don't do anything
fancy)

You can create per-user filters as well by creating the executable file:
~/.lessfilter
One argument is passed to it: the file to display.

To use lesspipe, simply add to your environment:
export LESSOPEN="|lesspipe %s"

Run 'less --help' or 'man less' for more info
#########################################

I would interpret the "don't do anything fancy" caveat on LESSIGNORE to mean
that wildcards may not work. Some experimenting on my system shows me that
this version seems to do what you want:

LESSIGNORE="htm html"

I don't normally have LESSOPEN set, so I havn't seen this situation before.

--
Reverend Paul Colquhoun, ULC. http://andor.dropbear.id.au/~paulcol
Before you criticize someone, you should walk a mile in their shoes.
Then, when you do, you'll be a mile away, and you'll have their shoes.
 
Old 05-13-2012, 07:15 AM
Stroller
 
Default less file.html

On 13 May 2012, at 06:57, Paul Colquhoun wrote:
> …
>>>>> You can set LESSIGNORE='*.htm*'. This environment variable is used by
>>>>> the lesspipe command, which is invoked by less and filters the input
>>>>> file before giving it to less itself.
>>>>
>> …
>> I have here now:
>>
>> $ env | grep -i less
>> PAGER=/usr/bin/less
>> LESS=-R -M --shift 5
>> LESSOPEN=|lesspipe %s
>> LESSIGNORE=*.htm*
>> $
>
> …
>
> I would interpret the "don't do anything fancy" caveat on LESSIGNORE to mean
> that wildcards may not work. Some experimenting on my system shows me that
> this version seems to do what you want:
>
> LESSIGNORE="htm html"
>
> I don't normally have LESSOPEN set, so I havn't seen this situation before.

Blimey! Thank you! That's wonderful!



Stroller.
 

Thread Tools




All times are GMT. The time now is 07:07 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org