Created
March 27, 2026 19:59
-
-
Save notmayo/c79774848630155ae7929f923d317fb6 to your computer and use it in GitHub Desktop.
Confluence HTML export - Find all macros used per page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| grep -I -oH '<[^>]*macro[^>]*>' ./*.html \ | |
| | grep -Fv 'src=confmacro' \ | |
| | awk -F: ' | |
| { | |
| file=$1 | |
| tag=$0 | |
| sub(/^[^:]*:/, "", tag) | |
| out=tag | |
| if (match(tag, /class="[^"]*macro[^"]*"/)) { | |
| out=substr(tag, RSTART+7, RLENGTH-8) | |
| } else if (match(tag, /class='\''[^'\'']*macro[^'\'']*'\''/)) { | |
| out=substr(tag, RSTART+7, RLENGTH-8) | |
| } else if (match(tag, /aria-label="[^"]*"/)) { | |
| out=substr(tag, RSTART+12, RLENGTH-13) | |
| } else if (match(tag, /[[:alnum:]_-]*macro[[:alnum:]_-]*/)) { | |
| out=substr(tag, RSTART, RLENGTH) | |
| } | |
| gsub(/rbtoc[0-9]+/, "rbtoc", out) | |
| key=file SUBSEP out | |
| if (seen[key]++) next | |
| if (file != last_file) { | |
| if (last_file != "") print "" | |
| print file | |
| last_file=file | |
| } | |
| print " - " out | |
| }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment