I’m trying to replace string ######### to $ in all files in $HOME/findreplace/ directory with below statements but I’m getting sed: Function s_#########_ cannot be parsed. error.
Thanks in advance for you help.
for file in $HOME/findreplace/*.*
do
sed -e "s_#########_$_g" $file> /tmp/tempfile.tmp
mv /tmp/tempfile.tmp $file
echo "Modified: " $file
done
You can do:
Explanation:
/instead where you had_before to separate the pattern to match and pattern to replace.\to escape the$char-ioption tosedto do in-place editing, so you can avoid having to use a temp file.$file) in double-quotes.