Fix duplicate output in disk-usage script with awk
Some checks failed
Deploy Borgmatic Configuration / Deploy to Production Server (push) Has been cancelled

Replace grep-based parsing with awk to properly capture header and data
lines without duplicates.

Changes:
- Use awk to capture header line (Original/Compressed/Deduplicated size)
- Print header followed by matching "All archives" line with sizes
- Exit immediately after first match to prevent duplicates

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
BeauTroll
2025-12-18 16:09:56 +01:00
parent b816e25caa
commit 07a98d5617

View File

@@ -27,7 +27,7 @@ echo ""
# Statistiques du repository Borg # Statistiques du repository Borg
echo -e "${YELLOW}Espace utilisé par le repository Borg (toutes archives):${NC}" echo -e "${YELLOW}Espace utilisé par le repository Borg (toutes archives):${NC}"
borgmatic info 2>/dev/null | grep -B1 "All archives" | grep -E "Original size|All archives" | head -2 borgmatic info 2>/dev/null | awk '/Original size.*Compressed size.*Deduplicated size/{header=$0; next} /All archives:.*[GT]B/{if(header) print header; print; exit}'
echo "" echo ""