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