home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / perl / scripts-convex / zoelim < prev    next >
Encoding:
Text File  |  1991-08-05  |  474 b   |  29 lines

  1. #!/usr/local/bin/perl
  2.  
  3. unshift(@ARGV, '-') if $#ARGV < $[;
  4. while ($ARGV = shift) {
  5.    &soelim($ARGV);
  6. }
  7.  
  8. sub soelim {
  9.     local($file) = @_;
  10.     local($_);
  11.     local(*FILE);
  12.  
  13.     $file =~ s/^(.+)\.Z$/zcat $1.Z |/;
  14.     if (!open (FILE, $file)) {
  15.     if ($! =~ /no such file/i) {
  16.         $file .= '.Z';
  17.         if (-e $file) {
  18.         &soelim($file);
  19.         return;
  20.         } 
  21.     }
  22.     die "$0: can't open $file: $!\n";
  23.     }
  24.     while (<FILE>) {
  25.     &soelim($1), next if /^\.so\s+(\S+)/;
  26.     print;
  27.     } 
  28.