Issue
I want to replace content: [],
with content: ['./src/**/*.{js,jsx,ts,tsx}'],
using sed and I'm trying this command:
echo content: [], | sed -e s/content: \[\]/content: \['\.\/src\/\*\*\/\*\.\{js,jsx,ts,tsx}']/
But I get this error:
zsh: no matches found: [],
sed: 1: "s/content:
": unterminated substitute pattern
Ideally I want to treat the two sides in the sed command as literal strings but apparently no matter what, it treats different characters as regular expression parts.
Solution
You'll need to wrap both the echo
and sed
command in quotes (""
) so ZSH won't expand them:
echo 'content: [],' | sed -e "s/content: \[\]/content: \['\.\/src\/\*\*\/\*\.\{js,jsx,ts,tsx}']/"
content: ['./src/**/*.{js,jsx,ts,tsx}'],
Answered By - 0stone0 Answer Checked By - Mary Flores (WPSolving Volunteer)