#!/usr/bin/perl use warnings; use strict; my @lines = (); while ( <> ) { if (/^#@/) { s/^#@[ \t]*//; push @lines, $_; } } my $lines = join '', @lines; # Now pipe $lines through any one of: # - texi2dvi # - texi2pdf # - makeinfo