Showing posts with label modifying multiple files. Show all posts
Showing posts with label modifying multiple files. Show all posts
Friday, 29 March 2013
Modifying multiple files in one stroke
The other day, I was working on code and felt that I had to change the date creation function and make use of SQLAlchemy's server_default = text("sysdate") from a rather bizare default = datetime.now()
so I run this;
sed -e 's/default = datetime.now()/server_default = text("sysdate")/g' -i models/*.py
and all python files were updated
Note: the letter g at the after the replacement text ensures that all instances of the
text to be replaced are actually replaced and not only the first instance if the g (global) were left out
Subscribe to:
Posts (Atom)