perl -ple'BEGIN { print "new text" }' infile > outfile