grep — Infrastructure
Network Patterns
Find all IPv4 addresses
grep -E '([0-9]{1,3}\.){3}[0-9]{1,3}' file
Extract IPs only
grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}' file
Unique IPs sorted
grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}' file | sort -u
IPv4 with CIDR notation
grep -E '([0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]{1,2}' file
DATA VLAN subnet
grep '10\.50\.1\.' file
Private IP ranges (RFC 1918)
grep -E '(10\.|172\.(1[6-9]|2[0-9]|3[01])\.|192\.168\.)' file
MAC address — colon-separated (Unix)
grep -Ei '([0-9a-f]{2}:){5}[0-9a-f]{2}' file
MAC address — hyphen-separated (Windows)
grep -Ei '([0-9a-f]{2}-){5}[0-9a-f]{2}' file
Attribute Extraction
All attributes from antora.yml
grep -E '^ [a-z]' antora.yml
Attribute names only
grep -oE '^ [a-z][a-z0-9-]*' antora.yml | tr -d ' '
Count total attributes
grep -c '^ [a-z]' antora.yml
Filter by category (vault, ISE, port, etc.)
grep -E '^ vault-' antora.yml
grep -E '^ ise-' antora.yml
grep -E '^ port-' antora.yml
grep -E '^ vyos-' antora.yml
Verify attribute exists before using
grep -P '^\s{4}\w' docs/antora.yml | grep -i 'mail'
Find attribute usage in a file
grep -n '{[a-z][a-z0-9-]*}' file.adoc
Extract unique attributes used
grep -oE '\{[a-z][a-z0-9-]*\}' file.adoc | sort -u
Audit undefined attributes — check each against antora.yml
grep -oP '\{\w+\}' file.adoc | sort -u | while read attr; do
key=$(echo "$attr" | tr -d '{}')
grep -q "^ $key:" docs/antora.yml || echo "NOT DEFINED: $attr"
done
Hardcoded Value Audit
Find hardcoded IPv4 in docs
grep -rnE '([0-9]{1,3}\.){3}[0-9]{1,3}' docs/**/*.adoc
Exclude lines that already use attributes
grep -nE '([0-9]{1,3}\.){3}[0-9]{1,3}' file.adoc | grep -v '{.*-ip}'
Find hardcoded FQDNs (Domus infrastructure)
grep -nE '[a-z]+-[0-9]+\.inside\.domusdigitalis\.dev' file.adoc
Find short hostnames
grep -nE '\b(vault|ise|bind|k3s|kvm|vyos|wazuh)-[0-9]+\b' file.adoc
Exclude hostname attribute lines
grep -nE '[a-z]+-[0-9]+\.inside\.' file.adoc | grep -v '{.*-hostname}'
Hardcoded IPs in Domus network range (STD-019 violation)
grep -rnP '\b10\.50\.\d+\.\d+\b' --include='*.adoc' docs/modules/ROOT/pages/
Config Validation
Vault: check certificate SANs
openssl x509 -in cert.pem -noout -text | grep -oP '(?<=DNS:)[^,]+'
systemd: find failed units
systemctl list-units --failed --no-legend | grep -oP '^\S+'
Wazuh: extract rule IDs from alerts (top offenders)
grep -oP '"rule":\{"id":"(\K\d+)' /var/ossec/logs/alerts/alerts.json | sort | uniq -c | sort -rn
AsciiDoc: find inline TOC violations (STD-004)
grep -rnP '^:toc:' --include='*.adoc' docs/
AsciiDoc: find missing description headers
grep -rLP ':description:' --include='*.adoc' docs/modules/ROOT/pages/
AsciiDoc: find broken xrefs after directory rename
grep -rnP 'xref:codex/cli/' --include='*.adoc' docs/modules/ROOT/