What | tcl-augeas |
Where | https://github.com/dbohdan/tcl-augeas |
Description | A binary Tcl extension that proves bindings for the Augeas configuration editing tool. |
Platforms | Linux, FreeBSD, OpenBSD. |
Prerequisites | Tcl 8.5 or newer, Augeas 0.10 or newer. |
Updated | 03/2015 |
License | MIT |
Includes a build script that uses values from tcl::pkgconfig to build and install the extension in a way that works on across several different Linux distributions as well as on FreeBSD and OpenBSD.
package require augeas set id [::augeas::init /] foreach x [::augeas::match $id {/files/etc/hosts/*}] { set ipaddr [::augeas::get $id $x/ipaddr] set hostname [::augeas::get $id $x/canonical] puts [format %-30s%s $hostname $ipaddr] } ::augeas::close $id
On the default installation of Fedora 21 with no extra hosts added this produces the output of
localhost.localdomain 127.0.0.1 localhost6.localdomain6 ::1