With GNU find(1), xargs(1), and grep(1):
duplicate the directory structure:
cd /path/to/dest find /path/to/src -type d ! -path /path/to/src -printf '%P\0' | xargs -0 mkdir -prestore permissions:
rsync -a --existing /path/to/src /path/to/dest/copying files with the given pattern:
cd /path/to/src grep -rlZ pattern | \ (cd /path/to/dest; \ xargs -0 sh -c ' \ while [ $# -ne 0 ]; do \ grep pattern "/path/to/src/$1" >"$1"; \ shift; \ done' sh)