我目前正在尝试使用 Sed 读取位于 http://www.ftp.ncep.noaa.gov/data/nccf/com/rtma/prod/rtma2p5.20140522/ 的 Web 目录中的最后(最近)6 行。 .
我目前正在尝试使用较旧的代码,但它似乎并没有让我走得太远......
wget -q -O - http://www.ftp.ncep.noaa.gov/data/nccf/com/rtma/prod/rtma2p5.20140522/ |
grep '<a href=' | tail -6 | sed -e 's/.*\(rtma2p5.t[0-9]*z.2dvaranl_ndfd.grb2\).*/\1/'
最佳答案
类(class)用马。
wget -q -O - http://www.ftp.ncep.noaa.gov/data/nccf/com/rtma/prod/rtma2p5.20140522/ \
| tidy -asxml \
| xmlstarlet sel -t -m '*//_:a[position() > last() - 6]' -v '@href' -n
关于bash - 使用 Sed 读取目录中的最后 6 行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23818498/