#!/bin/bash
_subtitles_getSubtitlesForUrl() {
local awkCode2=
read -r -d "" awkCode2 << 'SEARCHFORIDSAWKEOF'
BEGIN {
fileSize = 0
fps = 0
time = 0
}
/td align="center"><p>0/ {
isTimeMatched = match($0, /td align="center"><p>0[^0-9]*([0-9\.]+)/)
if (isTimeMatched) {
time = substr($0, RSTART + 22, RLENGTH - 16)
}
}
/Rozmiar pliku/ {
isFileSizeMatched = match($0, /Rozmiar pliku:[^0-9]*([0-9\.]+)/)
if (isFileSizeMatched) {
fileSize = substr($0, RSTART + 18, RLENGTH - 14)
}
}
/Video FPS/ {
isFpsMatched = match($0, /Video FPS:[^0-9]*([0-9\.]+)/)
if (isFpsMatched) {
fps = substr($0, RSTART + 15, RLENGTH - 15)
}
}
/napiprojekt:/ {
isHrefMatched = match($0, /href="(napiprojekt:[^"]*)"/)
if (isHrefMatched) {
printf("%7s | fps: %6s |%10s | %s\n",time ,fps ,fileSize , substr($0, RSTART + 6, RLENGTH - 7))
}
}
SEARCHFORIDSAWKEOF
cat 1.html | busybox awk "$awkCode2"
}
_subtitles_getSubtitlesForUrl
键入捕获变量中的
time
数据,然后在匹配napiprojekt:
:时生成输出
td align=\"center\"><p>0
进行这两组更改后,代码生成:2
#########
# replace this:
time = substr($0, RSTART + 22, RLENGTH - 16)
# with this:
printf("%7s | fps: %6s |%10s | %s\n",substr($0, RSTART + 22, RLENGTH - 16) ,fps ,fileSize , napi_data)
#########
# replace this:
printf("%7s | fps: %6s |%10s | %s\n",time ,fps ,fileSize , substr($0, RSTART + 6, RLENGTH - 7))
# with this:
napi_data = substr($0, RSTART + 6, RLENGTH - 7)