Skip to content

Instantly share code, notes, and snippets.

@crspiccin
Last active October 6, 2021 16:07
Show Gist options
  • Save crspiccin/c49ba43a79c25bda5f02ff4fe60ba426 to your computer and use it in GitHub Desktop.
Save crspiccin/c49ba43a79c25bda5f02ff4fe60ba426 to your computer and use it in GitHub Desktop.
Parse users form cognito user poll extraction with awk
# list users from a cognito specific poll
aws cognito-idp list-users --user-pool-id us-east-1_aaaaa > users.txt
# awk script save to script_parse_users.awk
# run the script printing "username,id" csv like
awk -f script_parse_users.awk users.txt
{
if($1=="USERS"){
user=$6
} else if($1=="ATTRIBUTES" && $2=="sub"){
id=$3
} if(user != "" && id != ""){
print user","id
user=""
id=""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment