[NTLUG:Discuss] Quickest way to edit file?

Lance Simmons simmons.lance at gmail.com
Mon Jul 23 10:55:02 CDT 2007


On 7/23/07, Fred James <fredjame at fredjame.cnc.net> wrote:

> For a single address ...
> grep -v regex original_file > new_file

I've done something similar with sed a few times, but it still leaves
the extra step of renaming new_file back to original_file.

For some reason, that extra step is the problem for me -- apparently
it is too taxing for my feeble brain, because it slows me down every
time.  Did I come up with a unique name for new_file?  Did I mess up
when I renamed new_file back to original_file?  Am I sure I don't now
have _three_ files instead of one?  That I didn't just delete
everything by accident? Better check on that... and so on. By the time
I get finished, I could have done the job with vi many times over:

   vi file /suitable-pattern-fragment  dd :wq

So maybe vi is the fastest way for someone as easily confused as me.

-- 
Lance Simmons



More information about the Discuss mailing list