Next Trivial Utilities 79

pgrep: output format

              printf $format, $file, $_, $.;
     my $format;
     if (defined $opt_F) {
       $format = $opt_F . "\n";
     } else {
       my %format = 
        ( l => '%s'."\n",
          h => '%2$s'."\n",
          q => "",
         "" => $opt_I || @ARGV > 1 ? "%s: %s\n" : '%2$s'."\n",
         );
       my $fk = "";
       $fk .= 'l' if $opt_l;
       $fk .= 'h' if $opt_h;
       $fk .= 'q' if $opt_q;
       $format = $format{$fk};
       unless (defined $format) {
         warn "Incompatible options.\n";
         usage();
       }
     }


Next Menu Copyright © 2012 M. J. Dominus