这段代码:
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>//'
输出类似于:
112,915 people 10:44:54 PM Mar 18 2012
任何人都可以帮我把它打印成这样吗:
3/18/2012 22:44:54 112,915 people
谢谢!
最佳答案
你必须这样命令:
wget --output-document=- http://runescape.com/title.ws 2>/dev/null \
| grep PlayerCount \
| head -1l \
| sed 's/^[^>]*>//' \
| sed "s/currently.*$/$(date '+%m\/%d\/%Y %H:%m:%S')/" \
| cut -d">" -f 3,4 \
| sed 's/<\/span>//' \
| awk '{print $3, $4, $1, $2}'
关于linux - 改变脚本的输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9764383/