Pipeline Orchestration

find | xargs | grep — search file contents found by name
find /home/evanusmodestus/atelier/_bibliotheca/domus-captures/docs/modules/ROOT/pages \
  -name '*.adoc' -print0 \
  | xargs -0 grep -l 'See Also'
find | xargs | awk — aggregate line counts by directory
find /home/evanusmodestus/atelier/_bibliotheca/domus-captures/docs/modules/ROOT/partials/codex \
  -name '*.adoc' -print0 \
  | xargs -0 wc -l \
  | awk '/total$/{next} {sum+=$1; n++} END{printf "Files: %d  Total lines: %d  Avg: %.0f\n", n, sum, sum/n}'
grep | xargs | sed — bulk replace across matching files
# Preview what would change
grep -rl 'navtitle:' \
  /home/evanusmodestus/atelier/_bibliotheca/domus-captures/docs/modules/ROOT/pages/codex/awk/basics \
  | xargs -I{} sh -c 'echo "--- {} ---" && grep "navtitle:" "{}"'
Parallel repo status across domus repos
cat <<'EOF' > /tmp/domus-repos.txt
/home/evanusmodestus/atelier/_bibliotheca/domus-captures
/home/evanusmodestus/atelier/_bibliotheca/domus-infra-ops
/home/evanusmodestus/atelier/_bibliotheca/domus-ise-linux
/home/evanusmodestus/atelier/_bibliotheca/domus-docs
EOF
xargs -a /tmp/domus-repos.txt -P4 -I{} sh -c \
  'printf "%-60s %s\n" "{}" "$(git -C {} rev-parse --short HEAD 2>/dev/null || echo NO-GIT)"'
Docker container cleanup — stop and remove exited containers
# List exited containers
docker ps -aq --filter status=exited | xargs -r docker rm -v
# Stop all running containers
docker ps -q | xargs -r docker stop
# Remove dangling images
docker images -q --filter dangling=true | xargs -r docker rmi
Kubectl pod cleanup — delete pods in error state
kubectl get pods --field-selector=status.phase=Failed -o name \
  | xargs -r -n1 kubectl delete
Confirmation with -p before destructive operations
find /tmp -maxdepth 1 -name '*.tmp' -print0 \
  | xargs -0 -p -n1 rm -v
Pipeline: find adoc files, extract titles, sort alphabetically
find /home/evanusmodestus/atelier/_bibliotheca/domus-captures/docs/modules/ROOT/pages/codex/awk \
  -name '*.adoc' -not -name 'index.adoc' -print0 \
  | xargs -0 head -1 \
  | grep '^=' \
  | sort
Pipeline: count xrefs per file across all pages
find /home/evanusmodestus/atelier/_bibliotheca/domus-captures/docs/modules/ROOT/pages/codex \
  -name '*.adoc' -print0 \
  | xargs -0 grep -c 'xref:' \
  | awk -F: '$2>0' \
  | sort -t: -k2 -rn \
  | head -10
Pipeline: parallel file hashing with result aggregation
find /home/evanusmodestus/atelier/_bibliotheca/domus-captures/docs/modules/ROOT/partials/codex/awk \
  -name '*.adoc' -print0 \
  | xargs -0 -P4 sha256sum \
  | awk '{print $1}' \
  | sort -u \
  | wc -l