Steve [RubyTalk] wrote:
> This sounds an easy task, but I'm certain that I'm yet to find the most
> elegant solution.
>
> I have a text file which I want to process using ruby in order to update
> it.  I want to remove the single line which matches a regexp for which I
> have a definition.  I'd prefer not to explicitly use temporary files -
> however (and this is important) I also don't want to risk loosing data
> with corruptions if the ruby process is killed unexpectedly... and I
> definitely don't want a file other than the one with/without the line
> I'm deleting to be read by any other process.
>
> Is there something in a library which would make this task easy?

ruby -i.bak -ne 'print if $_ !~ /foo/' stuff.txt