Last active
January 20, 2018 12:26
-
-
Save voutilad/ef079af392375d921d3d6ced07857bb6 to your computer and use it in GitHub Desktop.
Helper script to dump table counts from Attivio 5.x
This file contains 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
#!/bin/sh | |
curl -s \ | |
-H "Accept:application/json" \ | |
-G "http://amrvwp000002474:17000/rest/searchApi/simpleCgi" \ | |
--data-urlencode "workflows=search" \ | |
--data-urlencode "q=*:*" \ | |
--data-urlencode "q.type=simple" \ | |
--data-urlencode "hits=0" \ | |
--data-urlencode "facet=table(maxnumbuckets=100)" \ | |
--data-urlencode "security.realmId=Anonymous" \ | |
--data-urlencode "security.principalId=Administrator" \ | |
--data-urlencode "security.principalName=Administrator" | \ | |
sed 's/[\[]/&\n/g' | \ | |
grep "value" | \ | |
sed 's/},{/\n/g' | \ | |
awk -F, '{print $1 " " $2}' | \ | |
sed 's/.*value":"//g' | \ | |
sed 's/".*:/,/g' | \ | |
awk -F, \ | |
'BEGIN { | |
printf("%-25s%+10s\n%-25s%+10s\n", "TABLE", "COUNT", "-----", "-----"); | |
x = 0; | |
} { | |
printf("%-25s%+10s\n", $1, $2); | |
x = x + $2 | |
} END { | |
printf("%-25s%+10s\n%-25s%+10s\n", "-----", "-----", "TOTAL", x); | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment