[Tutor] deleting one line in multiple files

Alan Gauld alan.gauld at btinternet.com
Fri Sep 14 20:46:42 CEST 2007


"bhaaluu" <bhaaluu at gmail.com> wrote

> I'm also looking into 'sed' for doing this.  I've used 'sed' in the 
> past for
> deleting a specific line from files, as well as doing simple search 
> and
> replace in a file. I just figured that if it can be done in 'sed,' 
> it
> can be done in Python much easier and maybe even more elegantly

Probably not because this is exactly the kind of task sed was
designed for. And using the right tool fotr the job is usually more
elegant and efficient than using a general purpose configured for
the job... If the editing was more complex and involved multiple
files (copying from file a to file b etc) then sed begins to creak and
Python becomes much better suited.

Alan G. 




More information about the Tutor mailing list