How to list all new and changed files in a Magento SUPEE patch

When patching a Magento website it’s useful to know which files are going to be affected so that you can run tests and check your custom template files. Here’s how to list all new and changed files in a Magento SUPEE patch file from the command line:

cat path/to/PATCH_SUPEE.sh | grep -E "diff[[:space:]]" | sed -E "s/.*[[:space:]](.*)/\1/g"

What we are doing is printing the contents of the patch file to the terminal with the cat command, we then pipe that to grep and search for all lines which have a the word “diff” followed by a space. Finally we pipe this to the sed command to give us just the part that we’re interested in.