我到目前为止创建了一个计数器并总结了一行。我需要的是一到七,一到三十,一到一百八十的范围。因此,我尝试了两次尝试,结果很混乱,没有。 据我所知,不可能一个接一个地放几个命令。愿有人可以帮助我。 提前致谢。
awk '
# the counter for the maximum of lines
(R=0; R<=181; R++)
# the array, embracing from the first to the 7th, 30th and 180th entry
# of that one row, e.g. $2
e[7, 30, 180] = "total "
# if there are more than a 180 it goes to /dev/null
if R==181 > /dev/null
# one attempt
if NF~/^7 && 30 && 180 $/ {print sum}
# second attempt
# the variable sum for the sum of row number two
# counting from 01 to 07, 01 to 30, 01 to 180
sum=(s += $0)
for (sum in e) print "sum is", s '