I am trying to find a server-side way to replace some text, preferably from the UNIX command-line, basically I have a Postscript file which contains a varying title, the line is:

%%Title: <<title>>

And i want to replace the line with

%%Title: My Document

But the first <<title>> is different for every file, can it be done via the command line or a Perl script etc??