Gentoo Archives: gentoo-user

From: Paul Colquhoun <paulcol@×××××××××××××××××.au>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] less file.html
Date: Sun, 13 May 2012 06:01:41
Message-Id: 7793812.V8ljv7GmsZ@bluering
In Reply to: Re: [gentoo-user] less file.html by Stroller
1 On Sun, 13 May 2012 05:12:59 Stroller wrote:
2 > On 13 May 2012, at 00:22, Alex Schuster wrote:
3 > > …
4 > >
5 > >>> You can set LESSIGNORE='*.htm*'. This environment variable is used by
6 > >>> the lesspipe command, which is invoked by less and filters the input
7 > >>> file before giving it to less itself.
8 > >>
9 > >> Contrary to my previous email, sent in error, that does NOT work.
10 > >>
11 > >> Did you check this yourself?
12 > >
13 > > Yes. I did not know about this mechanism before, but 'env|grep -i less'
14 > > showed the LESS and LESSOPEN environment variable, so I learnt about the
15 > > lesspipe command. lesspipe -h gives a little info, LESSIGNORE is shown
16 > > there.
17 >
18 > I have here now:
19 >
20 > $ env | grep -i less
21 > PAGER=/usr/bin/less
22 > LESS=-R -M --shift 5
23 > LESSOPEN=|lesspipe %s
24 > LESSIGNORE=*.htm*
25 > $
26
27
28 On my system, I get this as the lesspipe help message:
29
30 #########################################
31 [paulcol@bluering ~]
32 [Sun May 13 10:26:09]$ lesspipe --help
33 lesspipe: preproccess files before sending them to less
34
35 Usage: lesspipe <file>
36
37 lesspipe specific settings:
38 LESSCOLOR env - toggle colorizing of output (no/yes/always)
39 LESSCOLORIZER env - program used to colorize output (default:
40 code2color)
41 LESSIGNORE - list of extensions to ignore (don't do anything
42 fancy)
43
44 You can create per-user filters as well by creating the executable file:
45 ~/.lessfilter
46 One argument is passed to it: the file to display.
47
48 To use lesspipe, simply add to your environment:
49 export LESSOPEN="|lesspipe %s"
50
51 Run 'less --help' or 'man less' for more info
52 #########################################
53
54 I would interpret the "don't do anything fancy" caveat on LESSIGNORE to mean
55 that wildcards may not work. Some experimenting on my system shows me that
56 this version seems to do what you want:
57
58 LESSIGNORE="htm html"
59
60 I don't normally have LESSOPEN set, so I havn't seen this situation before.
61
62 --
63 Reverend Paul Colquhoun, ULC. http://andor.dropbear.id.au/~paulcol
64 Before you criticize someone, you should walk a mile in their shoes.
65 Then, when you do, you'll be a mile away, and you'll have their shoes.

Replies

Subject Author
Re: [gentoo-user] less file.html Stroller <stroller@××××××××××××××××××.uk>