SED Command – Why Sed Replace is Not Working

sed

sed -i 's/#DirectoryIndex index.html/#DirectoryIndex index.php /etc/httpd/conf/httpd.conf'

which gives out the error

sed: -e expression #1, char 57: unknown option to `s'

I am trying to replace index.html with index.php

Best Answer

You need to close the string before the filename. And you missed the closing /.

sed -i 's/#DirectoryIndex index.html/#DirectoryIndex index.php/' /etc/httpd/conf/httpd.conf
Related Topic