Excerpts from William Morgan's mail of 19 Apr 2005 (EDT):
> Sure, here's a two line version:
> 
> def clean_file(filename)
>   caption = "caption: new caption"
>   system %%ruby -i -pe '$_.gsub! /^caption:.*$/,"#{caption}"' #{filename}%
> end

Oh wait, I thought of a shorter version:

def clean_file(filename)
  caption = "caption: new caption"
  system %%perl -i -pe 's/^caption:.*$/#{caption}/' #{filename}%
end

-- 
William <wmorgan-ruby-talk / masanjin.net>