Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Average weekly rent price for advertised carparks on Auckland City Centre
# The following one-liner calculates the average weekly rent price for a carpark on Auckland City Centre (New Zealand)
curl -s '' | grep 'per week</' | sed 's/.*\$\(.*\) per week.*/\1/g' | awk '{ sum += $1; n++ } END { if (n > 0) print "$" sum / n " based on " n " advertised items."; }'
# Example output (2016-08-20): $77.7917 based on 24 advertised items.
# Note that this script doesn't consider pagination, but I tried a whole-country search
# of carparks and there were only 78 results, and Trademe didn't paginate, so I think
# it's not necessary.

This comment has been minimized.

Copy link
Owner Author

@marianogappa marianogappa commented Aug 20, 2016

Can be used for any trade me page that has "per week" items; just replace the url. Beware of pagination.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment