new tool
[hband-tools.git] / user-tools / header
blobf7299f3655b30f8f7dddee4d653c6286c41eb1d5
1 #!/usr/bin/env perl
3 =pod
5 =head1 NAME
7 header - Echo the input stream up to the first empty line (usual end-of-header marker)
9 =head1 SYNOPSIS
11 header I<FILE> [I<FILE> [I<FILE> [...]]]
13 header < I<FILE>
15 =cut
17 if(not @ARGV)
19 push @ARGV, '/dev/stdin';
22 for my $idx (0..$#ARGV)
24 my $path = $ARGV[$idx];
25 open my $fh, '<', $path;
26 while(<$fh>)
28 last if /^\r?\n?$/;
29 print;
31 if($idx < $#ARGV)
33 print "\n";