home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / doc / lsof / examples / 00README < prev    next >
Encoding:
Text File  |  2002-04-04  |  2.0 KB  |  56 lines

  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. The scripts are written in AWK, Perl 4 (4.036), and Perl 5 (5.001e
  17. through 5.006).  AWK scripts have a suffix of ``.awk''; Perl 4
  18. (which will work under Perl 5) scripts have a ``.perl4'' suffix;
  19. and Perl 5 scripts, ``.perl''.
  20.  
  21. Supply AWK scripts to your AWK interpreter with its -f option.  Supply
  22. lsof field output via a pipe -- e.g.,
  23.  
  24.     lsof -F | awk -f list_fields.awk
  25.  
  26. The Perl scripts use the Unix command interpreter line feature to
  27. specify the location of Perl -- i.e., the first line begins with
  28. ``#!'' and the path to the Perl interpreter follows.  If your system
  29. supports the command interpreter feature, but your Perl interpreters
  30. have different paths to them, just change the interpreter lines in
  31. the 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.  
  40. If your system doesn't support the command interpreter feature,
  41. you'll have to supply the scripts to your Perl interpreter on its
  42. command line -- e.g.,
  43.  
  44.     lsof -F | /<path_to_your_perl_4> list_fields.perl
  45.  
  46. The Perl scripts attempt to establish a path to lsof, putting their
  47. result in the $LSOF variable.  Assuming you'll run them from the
  48. scripts subdirectory, they look there first, then in the directories
  49. of the PATH environment variable.  If that proves unsuitable, modify
  50. the &isexec() subroutine calls in the scripts to suit your lsof
  51. location.
  52.  
  53.  
  54. Vic Abell
  55. April 4, 2002
  56.