From: William Morgan Date: 2005-04-20T08:40:24+09:00 Subject: Re: Modifying content in a file 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