Skip to content

Instantly share code, notes, and snippets.

@protosam
Created October 11, 2016 02:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save protosam/3e6633a8cc6148b32301a9040a3cac4d to your computer and use it in GitHub Desktop.
Save protosam/3e6633a8cc6148b32301a9040a3cac4d to your computer and use it in GitHub Desktop.
#!/bin/bash
echo Parsing .dek file: $1
echo
echo
echo Mainboard:
grep false $1 | tr '"' ' ' | cut -d'=' -f3,5 | awk -F'Sideboard=' '{print $1" "$2}' | sed -e 's:/>::g' | awk 'BEGIN{TOTAL=0}{print $0; TOTAL+=$1}END{print TOTAL" cards"}'
echo
echo
echo Sideboard:
grep true $1 | tr '"' ' ' | cut -d'=' -f3,5 | awk -F'Sideboard=' '{print $1" "$2}' | sed -e 's:/>::g' | awk 'BEGIN{TOTAL=0}{print $0; TOTAL+=$1}END{print TOTAL" cards"}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment