There's no need to filter hostnamectl's output with awk because its man
page says:
hostnamectl [OPTIONS...] {COMMAND}
--static, --transient, --pretty
If status is used (or no explicit command is given) and one
of those fields is given, hostnamectl will print out just
this selected hostname.
E.g. hostnamectl --static status => ansible.example.org
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| at | Loading commit data... | |
| authorized_key | Loading commit data... | |
| cron | Loading commit data... | |
| debconf | Loading commit data... | |
| facter | Loading commit data... | |
| filesystem | Loading commit data... | |
| firewalld | Loading commit data... | |
| group | Loading commit data... | |
| hostname | Loading commit data... | |
| kernel_blacklist | Loading commit data... | |
| locale_gen | Loading commit data... | |
| lvg | Loading commit data... | |
| lvol | Loading commit data... | |
| modprobe | Loading commit data... | |
| mount | Loading commit data... | |
| ohai | Loading commit data... | |
| open_iscsi | Loading commit data... | |
| ping | Loading commit data... | |
| seboolean | Loading commit data... | |
| selinux | Loading commit data... | |
| service | Loading commit data... | |
| setup | Loading commit data... | |
| sysctl | Loading commit data... | |
| ufw | Loading commit data... | |
| user | Loading commit data... | |
| zfs | Loading commit data... |