$ echo xx__SRCxxx | sed "s/__SRC/ ` echo ./yuv/foreman-qcif.yuv | sed 's/\./\\\./g;s/\//\\\//g' ` /g" sed: -e expression #1, char 20: unknown option to `s' xx xxx $ ========== == escapes correct BUT sed refuse to accept it inside s// :/ == $ echo ./yuv/foreman-qcif.yuv | sed 's/\./\\\./g;s/\//\\\//g' \.\/yuv\/foreman-qcif\.yuv