std/c/README.md: Add section skeletons and don't indent lists
[sunny256-utils.git] / skipline
blobf60a4b6d1f727a507598d0629b1d7084a93c684e
1 #!/usr/bin/env perl
3 # skipline
4 # File ID: dcd11fb0-5d43-11df-8525-90e6ba3022ac
5 # Only prints every n'th line from stdin
7 use warnings;
9 defined($ARGV[0]) || die("\nSyntax: $0 number_of_lines_to_skip [file [...]]\n\n");
11 my $Skip = $ARGV[0];
12 shift;
14 ($Skip =~ /[^0-9]/) && die("$Skip: Invalid character in number");
15 $Skip || die("Number has to be greater than zero");
17 my $Count = 0;
19 while(<>) {
20 ($Count++ % $Skip) || print;