Apply patch to specified file, completely ignoring the path/filename stored in the patch file?

If the patch only contains changes to a single file, you should be able to tell patch to apply those changes to a file of your choice by specifying it before the patch name:

patch myfile withthis.patch

will apply withthis.patch to myfile, ignoring the file name in the patch.

Quoting the man page:

The names of the files to be patched are usually taken from the patch file, but if there's just one file to be patched it can be specified on the command line as originalfile.

Tags:

Patch