diff --git a/src/Makefile.am b/src/Makefile.am
index b71e69485f..09389a82b2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3072,8 +3072,9 @@ if WITH_NETWORK
$(INSTALL_DATA) $(srcdir)/network/default.xml \
$(DESTDIR)$(confdir)/qemu/networks/default.xml
test -z "$(UUID)" || \
- { sed -e "s,,\n $(UUID)," \
- $(DESTDIR)$(confdir)/qemu/networks/default.xml > \
+ { sed -e "s,,; $(UUID)," \
+ $(DESTDIR)$(confdir)/qemu/networks/default.xml | \
+ tr ";" "\n" > \
$(DESTDIR)$(confdir)/qemu/networks/default.xml.t && \
cp $(DESTDIR)$(confdir)/qemu/networks/default.xml.t \
$(DESTDIR)$(confdir)/qemu/networks/default.xml && \