Config Surgery
Bulk xref rename across AsciiDoc files
# Rename a page reference across the entire repo
grep -rl 'xref:codex/text/sed.adoc' \
/home/evanusmodestus/atelier/_bibliotheca/domus-captures/docs/modules/ROOT/ | \
xargs sed -i 's|xref:codex/text/sed.adoc|xref:codex/sed/index.adoc|g'
Comment out a config directive — sshd_config
cat <<'EOF' > /tmp/sshd_test.conf
PermitRootLogin no
PasswordAuthentication yes
X11Forwarding yes
EOF
sed -i 's/^X11Forwarding/#X11Forwarding/' /tmp/sshd_test.conf
cat /tmp/sshd_test.conf
Uncomment a config directive — remove leading #
cat <<'EOF' > /tmp/sshd_test.conf
#PermitRootLogin no
PasswordAuthentication yes
#PubkeyAuthentication yes
EOF
sed -i 's/^#PubkeyAuthentication/PubkeyAuthentication/' /tmp/sshd_test.conf
cat /tmp/sshd_test.conf
Transform Antora attribute keys to environment variables
cat <<'EOF' > /tmp/attributes.yml
ad-dc-ip: 10.50.1.50
ise-pan-ip: 10.50.1.20
pfsense-ip: 10.50.1.1
ws-aw-hostname: modestus-aw
EOF
sed 's/^ *\([a-z-]*\): \(.*\)/\U\1\E=\2/;s/-/_/g' /tmp/attributes.yml
Escape AsciiDoc attribute references for literal display
echo 'Connect to {ad-dc-ip} on port {port-ldaps}' | \
sed 's/{\([^}]*\)}/\\{\1}/g'
Strip ANSI escape codes from terminal output
printf '\033[1;31mERROR\033[0m: something failed\n' | \
sed 's/\x1b\[[0-9;]*m//g'
Config surgery — replace value in INI-style section
cat <<'EOF' > /tmp/app.ini
[database]
host = localhost
port = 3306
[cache]
host = localhost
port = 6379
EOF
sed '/^\[database\]/,/^\[/{s/host = localhost/host = 10.50.1.50/}' /tmp/app.ini
Bulk rename nav entries — update page paths
cat <<'EOF' > /tmp/nav.adoc
*** xref:codex/text/sed.adoc[sed]
*** xref:codex/text/awk.adoc[awk]
*** xref:codex/text/grep.adoc[grep]
EOF
sed 's|codex/text/sed.adoc|codex/sed/index.adoc[sed Stream Editor]|' /tmp/nav.adoc
Insert include directive after a marker line
cat <<'EOF' > /tmp/worklog.adoc
= WRKLOG-2026-04-11
== Summary
== Session Accomplishments
EOF
sed '/== Session Accomplishments/a\include::partial$worklog/personal.adoc[]' /tmp/worklog.adoc
Remove duplicate blank lines — squeeze whitespace
cat <<'EOF' > /tmp/messy.adoc
= Title
== Section One
Content here.
== Section Two
EOF
sed '/^$/N;/^\n$/d' /tmp/messy.adoc