| 1 |
|
| 2 |
Notes on Using the Scripts in This Subdirectory |
| 3 |
|
| 4 |
The scripts in this subdirectory are examples of post-processing |
| 5 |
lsof field output. Some are contributed by lsof users and are |
| 6 |
reproduced substantially as written by those users. Since the |
| 7 |
scripts are examples, they are not guaranteed to work on all UNIX |
| 8 |
dialects. Use them to learn about processing field output, don't |
| 9 |
expect them to be ready for production, and expect to be required |
| 10 |
to modify them to make them work. |
| 11 |
|
| 12 |
If you want to do field output post-processing in a C program, take |
| 13 |
a look at the test suite C library in ../tests/LTlib.c. You may |
| 14 |
be able to adapt it to your needs. |
| 15 |
|
| 16 |
Supply AWK scripts to your AWK interpreter with its -f option. Supply |
| 17 |
lsof field output via a pipe -- e.g., |
| 18 |
|
| 19 |
lsof -F | awk -f list_fields.awk |
| 20 |
|
| 21 |
The Perl scripts use the Unix command interpreter line feature to |
| 22 |
specify the location of Perl -- i.e., the first line begins with |
| 23 |
``#!'' and the path to the Perl interpreter follows. If your system |
| 24 |
supports the command interpreter feature, but your Perl interpreters |
| 25 |
have different paths to them, just change the interpreter lines in |
| 26 |
the scripts. These scripts assume Perl lives at /usr/bin/perl. |
| 27 |
|
| 28 |
If your system doesn't support the command interpreter feature, |
| 29 |
you'll have to supply the scripts to your Perl interpreter on its |
| 30 |
command line -- e.g., |
| 31 |
|
| 32 |
lsof -F | /<path_to_your_perl> list_fields.pl |
| 33 |
|
| 34 |
The Perl scripts attempt to establish a path to lsof, putting their |
| 35 |
result in the $LSOF variable. Assuming you'll run them from the |
| 36 |
scripts subdirectory, they look there first, then in the directories |
| 37 |
of the PATH environment variable. If that proves unsuitable, modify |
| 38 |
the &isexec() subroutine calls in the scripts to suit your lsof |
| 39 |
location. |
| 40 |
|
| 41 |
|
| 42 |
Vic Abell |
| 43 |
April 4, 2002 |