I have a file like this
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
</VirtualHost>
I would like to achieve this:
<VirtualHost *:80>
ServerAdmin info@domain.com
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
</VirtualHost>
I tired this but the line carriage doesn’t work properly.
I even tried \r\n without luck.
sudo sed -i "s/webmaster@localhost/info@domain.com\rServerName domain.com \rServerAlias www.domain.com/" /etc/apache2/sites-available/domain
I get this weird character there between:
<VirtualHost _default_:443>
ServerAdmin info@domain.com ^MServerName domain.com ^MServerAlias www.domain.com
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
</VirtualHost>
What am I missing?
Many Thanks,
The Unix text file line ending char is
\n, ASCII 0x0A (new line/line feed).\r0xOD is a carriage return.Replace
\rby\nin your sed expression and you should be good to go.