Skip to content

Instantly share code, notes, and snippets.

@gdm
Last active April 10, 2019 19:16
Show Gist options
  • Select an option

  • Save gdm/f829b5bb3d50f9f04ee8567607f0eb96 to your computer and use it in GitHub Desktop.

Select an option

Save gdm/f829b5bb3d50f9f04ee8567607f0eb96 to your computer and use it in GitHub Desktop.
# usefull when parse output frow aws cli
# from https://github.com/stedolan/jq/issues/370
jq '.Attributes[] | select (.Name == "public_ip") | .Value'
# json to bash-style env
jq -r 'to_entries | .[] | .key + "=\"" + .value + "\""' | grep -P '^AWS_(REGION|ACCESS_KEY|SECRET|SESSION)'
# parse CloudTail logs (from http://flaws2.cloud/defender3.htm )
jq -cr '.Records[]|[.eventTime, .sourceIPAddress, .userIdentity.arn, .userIdentity.accountId, .userIdentity.type, .eventName]|@tsv' | sort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment