Created
November 1, 2013 04:23
-
-
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 …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -sL 'http://192.168.0.1/cgi-bin/index.cgi?Command=11' |\ | |
sed 's#<br> ##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' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
curl -sL "http://192.168.0.1/getdeviceinfo/info.bin" | grep "AllowanceRemaining"