48.12 Using index with a FilterA particularly useful feature of the index ( 48.11 ) program is that you can use the -f option to filter the output. When a filter is used, the index program produces output in TAB-separated columns. Instead of listing each matching entry individually, the field titles are shown at the top, and each entry then appears underneath, displayed horizontally, with TABs between fields:
% The TAB-separated fields don't line up properly on your screen, but they make it convenient to manipulate columns using cut ( 35.14 ) , awk ( 33.11 ) , or perl ( 37.1 ) . For example, you can use the cut command as your filter to limit the output to a few significant fields:
%
(We use
For your convenience, you can write up a shell script as a filter
and place it in your
$HOME/.index
directory with a
.fmt
suffix.
This feature comes in useful for particularly complicated filter
programs.
For example, if you want
to be able to read the output of the previous
example properly, you can try using
awk
as shown in article
35.22
,
or you can just use
tbl
(
43.15
)
and
nroff
(
43.13
)
.
To do this in a single step, try writing a filter
[Linda is a great typist; she uses
- |
|