#!/usr/bin/perl -i.bak use English; undef $INPUT_RECORD_SEPARATOR; $file = <>; $file =~ s/\n\\begin{align\*}/\\begin{align\*}/g; print $file;