Skip to content

Instantly share code, notes, and snippets.

@mdiluz
Last active June 20, 2018 16:01
Show Gist options
  • Save mdiluz/a4cc07daa64dfac2fef216495f3b2f52 to your computer and use it in GitHub Desktop.
Save mdiluz/a4cc07daa64dfac2fef216495f3b2f52 to your computer and use it in GitHub Desktop.
Simple script to total up steam purchases
# Simple script to total up steam purchases from https://store.steampowered.com/account/history/
# Make sure you've fully loaded all purchases and copy & paste the whole table text in a text file.
#
# $ awk -f steam_purchases.awk my_logs.txt
# Cash purchases: £1000.00
# Wallet purchases: £200.00
# Total 'spent': £3000.00
# Wallet balance bought: £180.00
# Total gifted: £100.00
START {
gift=0
}
/Gift Purchase/ {
gift=1
}
/\,/ {
gift=0
}
/\tVisa/ {
val=substr($1,2)
cash+=val
if(gift) gf+=val
}
/Visa\t|^PayPal|MasterCard\t/ {
getline
val=substr($1,2)
cash+=val
if(gift) gf+=val
}
/^Wallet/ {
getline
val=substr($1,2)
wal+=val
if(gift) gf+=val
}
/\tWallet/ {
val=substr($1,2)
wal+=val
if(gift) gf+=val
}
/Purchased.*Wallet Credit/ {
onwal+=substr($5,2)
}
END {
print "Cash purchases:\t£"cash
print "Wallet purchases:\t£"wal
print "Total 'spent':\t£"cash+wal
print "Wallet balance bought:\t£"onwal
print "Total gifted:\t£"gf
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment