Delete lines containing a specific word

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Sun Jan 6 22:57:52 EST 2008


On Mon, 07 Jan 2008 00:42:01 +0000, Grant Edwards wrote:

>> If you want to delete them, you still have to do the rest of the job
>> yourself.
> 
> Nonsense.
> 
> How is this not doing what the OP asks?
> 
>    grep -v pattern infile >outfile; mv outfile infile

It isn't deleting lines. As abstractions go, it comes pretty close, but 
just try it on a disk with insufficient free space for the temporary 
outfile and watch it break.


-- 
Steven



More information about the Python-list mailing list