1#!/usr/bin/env perl 2# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3# 4# SPDX-License-Identifier: curl 5# 6# Given: a libcurl curldown man page 7# Outputs: the same file, minus the header 8# 9 10my $f = $ARGV[0]; 11 12open(F, "<$f") or die; 13 14my @out; 15my $line = 0; 16my $hideheader = 0; 17 18while(<F>) { 19 if($hideheader) { 20 if(/^---/) { 21 # end if hiding 22 $hideheader = 0; 23 } 24 push @out, "\n"; # replace with blank 25 next; 26 } 27 elsif(!$line++ && /^---/) { 28 # starts with a header, strip off the header 29 $hideheader = 1; 30 push @out, "\n"; # replace with blank 31 next; 32 } 33 push @out, $_; 34} 35close(F); 36 37open(O, ">$f") or die; 38for my $l (@out) { 39 print O $l; 40} 41close(O); 42