Skip to content

Instantly share code, notes, and snippets.

@polyglothacker
Created May 13, 2022 13:27
Show Gist options
  • Save polyglothacker/ef8a84e34f0fb4b41878ca46fb237649 to your computer and use it in GitHub Desktop.
Save polyglothacker/ef8a84e34f0fb4b41878ca46fb237649 to your computer and use it in GitHub Desktop.
# Shell commands to add "x" values
$ $ cat alerts.json | grep "x" | sed 's/"x"://g' | awk '{sum += $NF} END {print sum}'
50237
$ cat alerts.json | grep "x" | sed 's/,//g' | awk -F ":" '{sum += $NF} END {print sum}'
50237
$ cat alerts.json | grep "x" | cut -d ":" -f 2 | awk '{ sum += $0} END {print sum}'
50237
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment