Skip to content

Instantly share code, notes, and snippets.

@adrianbiro
Last active June 15, 2022 13:28
Show Gist options
  • Save adrianbiro/9a7cfd1e7dd31f97984949e6883a4df8 to your computer and use it in GitHub Desktop.
Save adrianbiro/9a7cfd1e7dd31f97984949e6883a4df8 to your computer and use it in GitHub Desktop.
Generate attendance at the conference for the report as a CSV file.
#!/bin/bash
#for i in {1..100};
#do
# curl https://randomuser.me/api/ >> conference_attendance.json
#done
curl https://randomuser.me/api/?results=700 >> conference_attendance.json
echo '"Lastname","Forename","Age","City","Country"' > conference.csv
jq -rC '[.results[] | select(.dob.age > 21) | {person: [.name.last, .name.first, .dob.age, .location.city, .location.country]}] | sort_by(.name.last) | reverse | .[] | add | @csv' conference_attendance.json >> conference.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment