Skip to content

Instantly share code, notes, and snippets.

@tjluoma
Created November 1, 2013 04:23
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 tjluoma/7260924 to your computer and use it in GitHub Desktop.
Save tjluoma/7260924 to your computer and use it in GitHub Desktop.
This is the prettiest bit of ugly code I have written in a long time. My HughesNet HT1000 modem shows me my quota information as this URL: http://192.168.0.1/cgi-bin/index.cgi?Command=11 but it is filled with extraneous information and really ugly HTML. This parses it and gives me a very nicely formatted bit of plain text as the output. Oh, and …
curl -sL 'http://192.168.0.1/cgi-bin/index.cgi?Command=11' |\
sed 's#<br>&nbsp;##g ; s#</div>##g ; s#</td>##g; s#<td>##g;
s#<div class="tooltip">##g; s#<td align="left" valign="top">##g ;
s#<span class="info">.*</span>##g; /<\/table>/,$d' |\
tr -s '\012| |\t' ' ' |\
sed 's#.*Data Allowance Remaining#Data Allowance Remaining#g ;
s#</tr> <tr> #\
#g; s#<td align="left" valign="top" colspan="2">##g ; s#</tr>##g'
@goldfndr
Copy link

goldfndr commented Nov 1, 2013

curl -sL "http://192.168.0.1/getdeviceinfo/info.bin" | grep "AllowanceRemaining"

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