Skip to content

Instantly share code, notes, and snippets.

@voutilad
Last active January 20, 2018 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save voutilad/ef079af392375d921d3d6ced07857bb6 to your computer and use it in GitHub Desktop.
Save voutilad/ef079af392375d921d3d6ced07857bb6 to your computer and use it in GitHub Desktop.
Helper script to dump table counts from Attivio 5.x
#!/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