Last active
October 6, 2021 16:07
-
-
Save crspiccin/c49ba43a79c25bda5f02ff4fe60ba426 to your computer and use it in GitHub Desktop.
Parse users form cognito user poll extraction with awk
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
# 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 | |
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
{ | |
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