home *** CD-ROM | disk | FTP | other *** search
/ AMIGA PD 1 / AMIGA-PD-1.iso / NetBSD / docs-netbsd / Networking-FAQ / cutout < prev    next >
Text File  |  1994-11-27  |  487b  |  32 lines

  1. #!/home2/rrzc1/fh/c9020/bin/perl -- #-*- perl -*-
  2.  
  3. if($#ARGV==-1){
  4.     print "Usage: $0 file\n";
  5.     exit 1;
  6. }
  7.  
  8. $file="$ARGV[0]";
  9.  
  10. open(IN,"<$file") || die;
  11.  
  12. while(<IN>){
  13.     if(($out)=/@comment %\*\*start cutout (.+)\n/){
  14.     print "Extracting '$out'... ";
  15.     $in=<IN>;
  16.     if(!open(OUT,">$out")){
  17.         print "failed!\n";
  18.     }else{
  19.         while($in!~/@comment %\*\*end cutout/){
  20.         print OUT $in if($in!~/^@/);
  21.         $in=<IN>;
  22.         }
  23.         print "done.\n";
  24.         
  25.         close(OUT);
  26.     }
  27.     }
  28. }
  29.  
  30. close(IN);
  31.  
  32.