Command line find and replace for updating version numbers

In order to prevent a website from caching your css/js/whatever you can add a variable to the call and update it when you release new code.

Here’s an example of a quick way to update all of the calls via command line in any particular directory:

find ./ -type f -exec sed -i -e 's/master.min.css?v=1.1.1/master.min.css?v=1.1.2/g' {} \;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.