Sed-like configuration file editing with virt-edit

A new option in virt-edit lets you non-interactively edit files in a virtual machine, somewhat like using sed or perl -pe. For example, change the init default level to 3:

virt-edit test.img /etc/inittab -e 's/^id:.*/id:3:initdefault:/'

Delete the root password from a VM:

virt-edit test.img /etc/passwd -e 's/^root:.*?:/root::/'

1 Comment

Filed under Uncategorized

One response to “Sed-like configuration file editing with virt-edit

  1. frankiii

    Must. Backport. To. EPEL5.

    I’m dying here in 1.2.11 land! πŸ™‚

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.