Expand all newcommands in the list ‘newcommands’ of (pattern, replacement) pairs. source can be a filename or just a string with text. If source is a filename, a backup file with extension .old~ is first made and then the original file is overwritten by the new text with expanded commands.