游戏 A 和 B 的玩家:
wget --output-document=- http://runescape.com/title.ws 2>/dev/null \
| grep PlayerCount \
| head -1l \
| sed 's/^[^>]*>//' \
| sed "s/currently.*$/$(date '+%r %b %d %Y')/" \
| cut -d">" -f 3,4 \
| sed 's/<\/span>//'
输出:111,048 people 10:43:54 PM Feb 22 2013
游戏B的玩家:
wget --output-document=- http://oldschool.runescape.com/ 2>/dev/null | grep "people playing"
输出:There are currently 42823 people playing!
我想计算有多少人玩游戏 A,但我不太确定如何从这两个输出中获取数字,然后减去它们并以相同的格式输出它们,如下所示:
`111,048 people 10:43:54 PM Feb 22 2013`