summaryrefslogtreecommitdiff
path: root/downsample (plain)
blob: 5ce9584bcdf55c46dc7de36999d91f3a407d6a98
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;

sub usage {
  print "usage: $0 [-p <pct>] <file>\n";
  exit(-1);
}

our $pct = 10;
our $help;
usage unless GetOptions("pct=i",   => \$pct,
                        "help"     => \$help);
usage if $help;

while (<>) {
  print if ((int rand 100) < $pct);
}