#!/usr/bin/perl -w use strict; for (@ARGV) { my($file) = $_; open(IN, $file) || die("Failed opening $file: $!\n"); my($string) = join("", ); close IN; $string =~ s/\r\n/\n/g; # kill the "text" link $string =~ s|Text  ||; open(OUT, "> $file") || die("Failed opening $file for output: $!\n"); print OUT $string; close OUT; # get and format the title $string =~ m|(.*?)|i; print qq|$1
\n|; }