#!/usr/bin/env perl use strict; use warnings; ######################################################## # # # Set the input record separator to pairs of newlines. # # # ######################################################## $/="\n\n"; if (scalar @ARGV == 0 || $ARGV[0] eq '-h' || $ARGV[0] eq '--help' ) { print <", $out_file or die "Can't open $out_file for writing: $!"; chomp(my @blocks = @{[<$in_fh>]}); close $in_fh; my $title = shift @blocks; $title =~ s/^=+\s+(.*)\s+=+/$1/; chomp($title); (my $short_title = $title) =~ s/^PostgreSQL //i; print $out_fh < $short_title

$title

TITLE foreach my $block (@blocks) { if ($block =~ /^=+\s+(.*)\s+=+$/) { print $out_fh <$1 HEADER } else { $block =~ s(http\S+)($&)g; print $out_fh < $block

PARAGRAPH } } close $out_fh; }