virt-edit is similar to the guestfish
edit command. It can be used to interactively edit a single file within a guest virtual machine. For example, you may need to edit the
grub.conf file in a Linux-based guest virtual machine that will not boot:
# virt-edit LinuxGuest /boot/grub/grub.conf
virt-edit has another mode where it can be used to make simple non-interactive changes to a single file. For this, the -e option is used. This command, for example, changes the root password in a Linux guest virtual machine to having no password:
# virt-edit LinuxGuest /etc/passwd -e 's/^root:.*?:/root::/'