Skip to content

Instantly share code, notes, and snippets.

@ninadsp
Created January 6, 2018 06:58
Show Gist options
  • Save ninadsp/afcddf77c52d7182d76d6bfd941a3c20 to your computer and use it in GitHub Desktop.
Save ninadsp/afcddf77c52d7182d76d6bfd941a3c20 to your computer and use it in GitHub Desktop.
Airtel Smartbytes Data Consumption Bash One Liner
Credits to:
# Airtel specific
https://github.com/paambaati/airtel-usage
https://gist.github.com/r4um/3414116
# General Bash help
StackOverflow
nixCraft/Vivek Gite
Available under WTFPL/MIT License.
# OSX version which assumes that GNU paste is available as gpaste
curl -s http://122.160.230.125:8080/gbod/gb_on_demand.do | grep -e dslID -e totalQuotaInGB -e currentQuotaInGB -e balanceQuotaInGB -e remainingDays -e bcCarryOverQuota | grep "name=" | while IFS= read -r -a LINE - ; do echo "$LINE" | grep -o -e 'name=[^ ]*' -e 'value=[^ /]*' | cut -f 2 -d '=' | gpaste -s -d':' | tr -d '"' ; done | gpaste -s -d ';'
# If GNU paste is available as paste
curl -s http://122.160.230.125:8080/gbod/gb_on_demand.do | grep -e dslID -e totalQuotaInGB -e currentQuotaInGB -e balanceQuotaInGB -e remainingDays -e bcCarryOverQuota | grep "name=" | while IFS= read -r -a LINE - ; do echo "$LINE" | grep -o -e 'name=[^ ]*' -e 'value=[^ /]*' | cut -f 2 -d '=' | paste -s -d':' | tr -d '"' ; done | paste -s -d ';'
# TODO: Termux edition, for Android users with notification support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment