Add license
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Webpage URL
|
||||
URL="https://www.kernel.org/pub/software/network/ethtool/"
|
||||
|
||||
# Cell to extract
|
||||
ROW=2
|
||||
COLUMN=1
|
||||
|
||||
# Get HTML table from webpage
|
||||
HTML_TABLE=$(curl -s -L "$URL" | sed -n -e '/<table>/,/<\/table>/ p' | sed -e 's/^[ \t]*//')
|
||||
|
||||
# Get row from $HTML_TABLE
|
||||
ROW_START=$(echo "$HTML_TABLE" | grep -n -m$ROW '<tr>' | tail -n1 | cut -d':' -f1)
|
||||
ROW_END=$(echo "$HTML_TABLE" | grep -n -m$ROW '</tr>' | tail -n1 | cut -d':' -f1)
|
||||
HTML_ROW=$(echo "$HTML_TABLE" | sed "$ROW_START,$ROW_END !d")
|
||||
|
||||
# Get column from $HTML_ROW
|
||||
HTML_COLUMN=$(echo "$HTML_ROW" | grep -m$COLUMN '^<td>' | tail -n1)
|
||||
|
||||
# Get version by removing HTML tags from $HTML_COLUMN
|
||||
VERSION=$(echo "$HTML_COLUMN" | sed 's|<[^>]*>||g')
|
||||
|
||||
echo "$VERSION"
|
||||
Reference in New Issue
Block a user