Multiple rename of files and their contents

In this case we rename any file containing the string `Ubuntu` with `Mass`:

for FILE in * ; do NEWFILE=`echo $FILE | sed ‘s/Ubuntu/Mass/g’` ; mv “$FILE” $NEWFILE ; done

Here we replace the contents of the file `Mass.vmdk`, any instace of the word `Ubuntu` is replaced with `Mass`:

sed -i ‘s/Ubuntu/Mass/g’ Mass.vmdk

Leave a Reply

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